Equivalent obj-c dealloc method in c++

Hi,
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

dealloc
{
;
someVariable = nil;
}
the c++ version equivalent will be:
void ClassName::delete
{
someVariavle
>release();
someVariavle = null;
}

Is this right?

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

ClassName::~ClassName() {
someVariable->release();
someVariable = NULL;
}

EDIT: fixed function header

1 Like

This is exactly what I was looking for.
Thanks