27Aug/08Off
What are requirements of classes whose objects are stored in container?
For C++ classes whose objects are stored inside containers like vectors, lists, deques, the following class items are generally required :
1. Constructors - naturally.
2. Copy Constructors - for creating objects that are stored inside the containers. These contained objects are actual copies of the originals that are inserted into the containers.
3. Destructors - naturally.
4. Assignment operator - needed especially when elements in the containers are removed (e.g. via the erase() method).
-----------------
This tip is provided by Mr. Lim Bio Liong, Original Tip could be found on this page.