Is it possible to construct a List<Object>
wherein the elements are uninstantiated classes, with the intention of getting one of the list elements and running a static method from that class or instantiating a new instance of that class? Also, how might one do this and how inadvisable is it (and why)?
To add some context: I want to make an application which generates a randomized city, placing buildings in the city, where each building is an instance of one of the many building classes, each inheriting from an abstract base class. To choose a building appropriate for a certain piece of land, the program may iterate over a list of all possible building classes, checking whether the required parameters can be met for that building (minimum / maximum height, footprint, shape, etc.) or these classes may be stored in some other manner, possibly using maps or some other structures. The bottom line is that I need to store (refferences?) to uninstantiated classes.