Advertisement

03.23.2005 at 11:18PM PST, ID: 21362942
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.2

How to transfer set of field array (using indexer) of same type between seperates class

Asked by riscy in Miscellaneous Programming

Tags:

I have field which is private as per OOP, the field is arrayed to represent different channels, my orginal plan is to use structure to combine field together and then create array. Below belong to specific window application class which is designed to be standalone.

            public struct DataDisplayStruct
            {
                  public string m_preample;
                  public bool m_enable;
                  public string m_coupling;
                  public float m_position;
                  public float m_offset;
                  public float m_voltDiv;
            }

            public DataDisplayStruct[] DataDisplay = { new DataDisplayStruct(), new DataDisplayStruct(), new DataDisplayStruct(),new
                                DataDisplayStruct(),new DataDisplayStruct(), new DataDisplayStruct()};
 
I created the object from the other class (form1) implementing "Display myTek = new Display()" However this seem to break the OOP rule as the field is exposed and must apply property for data validation. So I need to make field private, but I came up all sort of problem in channeling data transfer betwen classes, the damn complier does not know how to stop complaining!!.

Based on pass Expert Exchange and textbooks, I learn two method but does not solve problem....may be I missed something from my learning curve:-

Method A:- Indexor is a neat solution but how to make it unquie to field?. The complier complain since there is too many same type but unable to find reference to seperates indexor according to name rather than type:-

            private float[] m_voltDiv = new float[6];
            private float this[int index]
            {
                  get {return m_voltDiv[index];}
                  set {m_voltDiv[index]=value;}                  
            }
            private float[] m_offset = new float[6];
            private float this[int index3]
            {
                  get {return m_offset[index3];}
                  set {m_offset[index3]=value;}                  
            }
            private float[] m_position = new float[6];
            private float this[int index2]
            {
                  get {return m_position[index2];}
                  set {m_position[index2]=value;}                  
            }      
            private string[] m_preample= new string[6];
            
            private bool[] m_enable= new bool[6];
            
            private string[] m_coupling= new string[6];

Would not work...is there way around this?.

Method B:- found from previous ee, which they call it fake interface:- This is very neat but unable to find further reference to extend this methodm, anyone offer suggestion how to extend this to cover additional field variable?. As it stand it only deal one type, same problem as indexor.

      public interface IDisplayData
      {
            int[] this[int index] { get; set; }
      }                               

      public class TekDataDisplay : System.Windows.Forms.Form, IDisplayData
      {
.............
            public TekDataDisplay()
            {
                  InitializeComponent();      
                  m_data[0] = new int[10000];      //This is part of jagged array where init take place
                  m_data[1] = new int[10000];
                  m_data[2] = new int[10000];
                  m_data[3] = new int[10000];
                  m_data[4] = new int[10000];
                  m_data[5] = new int[10000];
            }
............
            int[] IDisplayData.this[int index]
            {
                  get {return m_data[index];}
                  set {m_data[index]=value;}
            }

            public IDisplayData RecordData            //TekDisplay.RecordData[0]=myTek.TekData_WaveformData;
            {
                  get {return this;}                        //this = TekVisaCS1....
                                }

Riscy.


Start Free Trial
 
 
[+][-]03.23.2005 at 11:53PM PST, ID: 13619476

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.24.2005 at 01:14AM PST, ID: 13619803

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.24.2005 at 02:08AM PST, ID: 13620092

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.24.2005 at 04:48AM PST, ID: 13621147

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.24.2005 at 04:50AM PST, ID: 13621156

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.24.2005 at 10:22AM PST, ID: 13624445

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.24.2005 at 10:59PM PST, ID: 13628237

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.25.2005 at 12:11AM PST, ID: 13628448

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Miscellaneous Programming
Tags: class
Sign Up Now!
Solution Provided By: bkdc
Participating Experts: 2
Solution Grade: B
 
 
[+][-]03.25.2005 at 12:12AM PST, ID: 13628453

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.25.2005 at 09:42AM PST, ID: 13631701

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32