I have 3 different classes (1 parent and 2 children), and I have created a heterogeneous array:
Parent parentArray = new Parent;
I would like to populate this array with 3 Parent objects, 3 child1 objects, and 3 child2 objects, in that order.
I would like to know if there is a more elegant way to do it than just doing this:
parentArray = new Parent(); parentArray = new Parent(); parentArray = new Parent(); parentArray = new Child1(); parentArray = new Child1(); .... parentArray = new Child2();