dimanche 16 juillet 2017

How can I fill the container of base class object with derived class object [duplicate]

Suppose that I have two classes named Object and ObjectManager respectively. the Object class is used for describing an object and the ObjectManagaer class function as the manager of the Object class, it allocates and releases memory for Objects, it has a container that stores the allocated objects.

The problem is, if I write a new class subobject derived from Object,and I also want to use an ObjectManager to manager the subobjects, then how can I put the subobject into the container ?

Aucun commentaire:

Enregistrer un commentaire