|
-
August 9th, 2012, 03:57 PM
#30
Re: Interview Questions
A good IDE should tell you that you inherit from a class that does not have a virtual destructor. I'd personally be surprised if the compiler didn't at least warn you as well. For the sake of documentation, I actually usually do this. Not so much in my own code, but when I am working with a team of people.
Code:
/* final */ class nonpolymorphic {
...
That way at a quick glance, you know whether or not a class may be inherited from. It's actually a little strange that C++ has no keyword for this like other languages.
@OReubens Wouldn't making all of your destructors virtual mean that all of your objects have vtables?
Also, lol, why does the text input box not have word wrap?
Last edited by ninja9578; August 9th, 2012 at 03:59 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|