Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

kudi

delete this

This topic is 5935 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
You can but be sure that you don''t access any more members after you''ve deleted the instance.

For instance:

node.Remove();
node.Log(); // Error!

Or:

void NODE::Remove()
{
delete this;
m_something = 0; // Error!
}

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
delete *this

Share this post


Link to post
Share on other sites
Thats kind of sloppy.

The general rule: Whatever does the new should be doing the delete.

Not only is it safer, but helps you find memory leaks... If you search a source and look for news and cooresponding deletes, and the delete is in another class... It makes it very difficult to track down.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!