|
![]() Click on image to see enlargment |
|
PC-lint/FlexeLint Output | Reference Manual Explanation | Home bug1510.cpp
In this example the printout shows that on Thanksgiving Day a turkey was purchased but it was never eaten in spite of the fact that the bird was taken to dinner. What went wrong? bug1510.cpp lint Output
--- Module: bug1510.cpp
_
virtual ~Turkey(){ printf("Eat turkey\n"); } };
bug1510.cpp(6) : Warning 1510: base class 'Bird' has no destructor
Reference Manual Explanation
1510 base class 'Name' has no destructor -- The indicated class is a
base class for some derived class that has a destructor. The
base class does not have a destructor. Is this a mistake? The
difficulty that you may encounter is this; if you represent (and
manipulate) a heterogeneous collection of possibly derived
objects via a pointer to the base class then you will need a
virtual base class destructor to invoke the derived class
destructor. [13, §4]
If you have comments or questions about this bug, please post them to our Discussion Forum |
Previous Bug - Bug #416 - October 2005