I have superclass (Class A) with a number of subclasses (Class B, Class C, Class D). I would like to create objects of any of these subclasses inside another class (class M) so that I can add the objects to an arraylist inside the class M.
I would like to know how I can create any of these subclasses inside class M.
The best way to go is the use the factory design pattern.
Update #1
Check these links