posted 15 years ago
Hey guys, Let's say I have three classes: Polygon, Rectangle, and Oval. Both Oval and Rectangle extend Polygon. So now I'm creating a new ArrayList that I want to hold Polygons and anything that is-a polygon (Rectangle, Oval, etc.).
How can I make an ArrayList take Polygon objects, and any object that is a subclass of Polygon?
Just simply doing this:
Does not work.