From: Kevin Butler <kbutler@ca...> - 2001-09-13 14:46:50
Stefan Farestam wrote:
> Suppose that I create a class A that is a subclass of a Java class.
> How can I convert instances of the baseclass to instances of the
Usually, the desire to convert instances of a base class into instances of a subclass indicates a design flaw.
That said, when it is needed, you create a constructor of the subclass that takes the base class instance and constructs a new instance that either wraps the base class instance or copies its data (a copy constructor).
Get latest updates about Open Source Projects, Conferences and News.