Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Where to delete class objects instantiated with the new operator in ofApp.cpp?

$
0
0

@p1r4t3b0y wrote:

Hi,

If I instantiate class objects inside ofApp.cpp, using the new operator - which allocates them in heap memory - , where do I need to delete them, if they remain valid until the application is closed?

Is there for instance something like an ofApp::exit() method that executes code right before quitting the application?
Or should I declare and define a destructor for the ofApp class, and if so, does it take care of the cleanup at the end, if I put delete myObject inside its definition?

I’m pretty new to C++! Any help is appreciated. :slight_smile:

Thanks.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles