Hello, i have some doubts with c++.
First of all, if i have a map of objects like this:
When i want to delete the object Person of an instance of the mapPersons, it is correct the next form:Code:class People { map<int,Person> mapPersons; string city; int code; } class Person{ int id; string name; string phone; }
or maybe i have to delete the object separately?Code:map<int,Person>::iterator iter=_socis.begin(); mapPersons.erase(iter);
How can i delette an object of the class People?Do i have to delete the map first?
If i want to clear the content of a map, with the function clear() the objects will be destroyed like if i call delete to all the objects?
How can i destroy objects?
Everything thinking than the destroyers are like this:Code://created like: Person p = Person() //to destroy? p.~person();
Thank you very much!!!Code:~People(){ } ~Person(){ }
Imanol.




Reply With Quote
