next up previous contents
Next: TPhEvent and TPhObjectManager Up: Data Containers Previous: Data persistence   Contents

Object ownership

The behaviour of the TPhObjectContainer destructor can be controlled with the SetIsOwner() member function. By default, the container 'owns' the objects that are stored inside it, calling their destructors when the container destructor is called. As the same object can in principle be stored in several containers, the SetIsOwner() member function can be used to declare only one container as owning the objects, making sure they are only deleted once (the consequences of deleting the same objects twice can actually be fairly desastrous if the space has been reused in the meantime).



Gunther Roland
2000-05-05