I'll post a screenshot of code because also want to show the variables while debugging. Screenshot:
Ok, so I have the code as on the screenshot and:
SystemClass *pSystemClass = new SystemClass();
// Use of pSystemClas
delete pSystemClass;
And the question, do I have to remove the pointers that are stored in vp_DatabaseManager vector before deleting pSystemClass or can I do it in SystemClass destructor as it is shown on the screenshot?
Because in the debug mode it looks like the vp_DatabaseManager vector is deleted before I can access the pointers in SystemClass destructor.
In the SystemClass
destructor, iterate through the vector
and delete the pointers. You can also research unique_ptr
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.