Nodes are, for example, of type A
, B
and C
.
Each of these nodes are different number of children. A
can have 2 children, B
can have 3 children and so on. Now, whether A
will have a reference to B
or C
is not known a priori.
How do I do this for n
nodes where each node is an object of a different class and can have a reference to any of the n-1
nodes?