c++ - Question about pointers and objects? -


Just wondering if I create an object, which has a pointer in the form of a data member and the object goes out of the scope, then just thinking,

There is nothing on the indicator, it does not exist anymore if it is something like that Was pointing to the need to be free, so you got the memory leak.

Either add code to the discoverer, which makes proper cleaning of the pointer or uses "smart pointers" which is clean

edit: If you really meant that you are creating a static object, by declaring it with the static keyword inside the function, the answer is different then a static object, once executed before the function Created by, who declares it, ends the program A continues. Its data will be valid, including subscribers, points. After work calls will reach the same object. If the object is allocated to any memory, it will be allocated until it will be explicitly removed.


Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -