I have 2 types of objects, Parents, and Children. I have an abstract class for these two objects. There are 2 types of parents, ParentA, ParentB and there are 2 types of children, ChildA, ChildB. These all inherited their corresponding base classes, i.e ParentA:Parent, ParentB:Parent, ChildA:Child, ChildB:Child.
Each parent has a collection of children. Type A Parents can only have Type A children, and Type B parents can only have TypeB children.
To add a child to a parent, I use the method addChild(child) defined in Parent abstract class. This method executes exactly the same for both parent types. In this method, I would like the parent to subcsribe tothe child's events. I use the following code:
internal void addChild(Child child)
{
//Code I execute to add the child
rChild.ChildPropertyChanged += ChildPropertyChanged;
}
Now, when I execute the following code:
ParentA parentA = new ParentA();
ChildA childA = new ChildA();
parentA.addChild(childA);
and follow the event in the childA object, I see that after the subcsription code above, the event is still null. Why is this event still null?