dealloc equivalent?

Was wondering where/how we implement dealloc or something similar? For reference, I’ve created an instance variable in testApp.h:

Ball *ball;  

Where Ball is an Objective-C class I wrote and instantiate with [[Ball alloc] init]. In the normal ObjC world, I’d need to release this somewhere, most likely the dealloc method. However, testApp.c being a C++ class, I’m a little unsure as to how I should handle this. Should I be inserting the code inside of exit()?

I’m not an expert, but I’m guessing that you’re correct: exit() would be the place for this.

void exit()

Add this function to your testApp to have it called at the moment before the app is terminated. This is useful for doing cleanup stuff or making sure files are saved before the app terminates.[/quote]

yup that’s right. testApp::exit() is the place for cleaning up.

Whoops, I’ve been using ~testApp(). Good to know there’s exit() :slight_smile: