Would it be a bad design, that a child class inherit a parent class that has no destructor (only the default generated by compiler) ? Some books claimed it’s not good, but didn’t mention under what situation it would.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Deleting an object of a derived type through a pointer to a base type with no virtual destructor is undefined behavior. If you expect to do this, and so in general if you expect your class to be extended, you should provide a
virtualdestructor.