Equivalent obj-c dealloc method in c++

Equivalent obj-c dealloc method in c++
0.0 0


I’m new to c**,
I want to know if exist some method in c** that is simliar to the dealloc method in obj-c, or it’s possible to simulate the dealloc method using cocos2d-x.


If “new” is analogue to “alloc” then “delete” is analogue to “dealloc”. Local objects created without “new” will be automatically destroyed when leaving scope.


When I use the following method in obj-c

someVariable = nil;
the c++ version equivalent will be:
void ClassName::delete
someVariavle = null;

Is this right?


Eh no. Now I see you meant destructors. C++ equivalent will be:

ClassName::~ClassName() {
someVariable = NULL;

EDIT: fixed function header


This is exactly what I was looking for.