We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CPP/week12/examples/virtual.cpp
Lines 5 to 14 in 14c7055
Lines 49 to 51 in 14c7055
delete p;
id
In general, we should explicitly define a virtual destructor in polymorphic base classes. See C.127: A class with a virtual function should have a virtual or protected destructor .
virtual
The text was updated successfully, but these errors were encountered:
No branches or pull requests
CPP/week12/examples/virtual.cpp
Lines 5 to 14 in 14c7055
The class Person doesn't have a user-written virtual destructor, so its destructor defaults to public non-virtual.
CPP/week12/examples/virtual.cpp
Lines 49 to 51 in 14c7055
The result of
delete p;
is undefined behavior, so it might call Person::~Person only and leak the stringid
.In general, we should explicitly define a
virtual
destructor in polymorphic base classes. See C.127: A class with a virtual function should have a virtual or protected destructor .The text was updated successfully, but these errors were encountered: