constructors constructing classes
hi.
in .NET 1.1 i didnt have this problem. im using .NET 2.0 now, perhaps something im doing wrong.
say I have 3 classes.
ClassA
ClassB
ClassC
one doesnt need to know about each other. so when constructing B, B knows nothing bout A, but A does as its constructing it. The same thing with Class C. so:
ClassA -> ClassB
ClassB -> ClassC
now, since ClassC may require some objects from ClassB, which has objects from ClassA, ClassB passes them to the ClassC Constructor but it shows them as null, except for ClassA (ClassB gets ClassA and shows it as a proper class even though ClassB is being constructed from ClassA Constructor)
After some "looking" into, I noticed that the objects will NOT be null when the constructors have been completed.
but then, when is the best time to set these objects/properties after construction of each class?
I hope you see my point.
in .NET 1.1 I could do:
Code:
//ClassA
this.ClassB = new ClassB(this);
//ClassB
this.classB = incomingValue;
this.ClassC = new ClassC(this, this.classB); //classB is null at this point
Re: constructors constructing classes
hmm disregard this
shouldve added another parameter to include the class itself of which it is constructing from, i.e:
ClassC (classB, classA)