Jump to content
  • Advertisement
Sign in to follow this  
Stiffler

Unity C++ virtual deconstructor

This topic is 4372 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

On this recent thread... click jfclavette asks some example questions and one of them is... - Why should a destructor never be virtual in C++ ? I was wondering why this is, with my understanding, having a virtual deconstructor would cause the deconstructor of a class that was dirived from this class to be called. Which is really important... But, I didn't know if I was wrong or if this was a trick question. Thanks for the help

Share this post


Link to post
Share on other sites
Advertisement
Making a base class destructor non virtual is one way of documenting that you don't want people to derive from your class.

Cheers
Chris

Share this post


Link to post
Share on other sites
Thanks a lot for the clarification guys... I thought it was too serious to have a trick question but I guess I was wrong.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!