Jason Anderson

Jason Anderson

  • NA
  • 7
  • 45.5k

How to use class as a data type?

May 9 2011 5:00 PM
I have a user-defined data type "ClassA".  I get an error when trying to set value of Attribute1.Attribute2.

public class Class1
{
public struct structA
{
        private int value1;
        
        public ClassA Attribute1
        {
                get{return value1;}
                set{value1=value;}
        }
}
public ClassA
{
        private int value2;

        public int Attribute2
        {
                get{return value2;}
                set{value2=value;}
        }
}

public ClassB
{
        public void GetData()
        {
                ...
                ...
                structA.Attribute1.Attribute2 = 10;
                ...
                ...
        }
}
}

I get an <undefined value> everytime I try to get or set Attribute1.Attribute2....Any ideas?

Thanks in advance.

Jason

Answers (1)