Answer the question
In order to leave comments, you need to log in
How to create an array or collection of objects?
Hi everybody). I now have three objects of different classes.
NewClassProgram NewObject1 = new NewClassProgram();
NewClassProgram2 NewObject2 = new NewClassProgram2();
NewClassProgram3 NewObject3 = new NewClassProgram3();
Answer the question
In order to leave comments, you need to log in
Make a class hierarchy, inherit your classes from one ancestor.
Then you can add classes converted to a common ancestor to the collection.
Usually, when questions like this arise, the classes line up nicely in a hierarchy with a common ancestor.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question