![]() |
Sponsored Link •
|
Advertisement
|
Advertisement
|
This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.
Message:
I come from a Delphi/Object Pascal background. In that language it is easy to define a type TShapeClass = class of TShape; I can then have some method that accepts these class references: If TBox is a subclass of TShape, I can pass in a reference to TBox into my SomeMethod and have it construct new instances of that class. I haven't seen how to do this in Java. Any suggestions? My implementation at the moment uses the Abstract Factory design pattern (someMethod takes a ShapeFactory as a parameter, so it can also accept a BoxFactory) but that seems a little like overkill.
Replies:
|
Sponsored Links
|