inhibit compiler warning C4624 for a class hierarchy



Error Message
'derived class' : destructor could not be generated because a base class
destructor is inaccessible


A destructor was not accessible in a base class and was therefore not
generated for a derived class. Any attempt to create an object of this type
on the stack will cause a compiler error.



For this particular hierarchy, that's completely acceptable and intended.
The objects should be allocated on the heap, used polymorphically, and
deleted using a base class function.

Can I mark the base class in any way such that this message isn't generated
for derived classes? Using #pragma warning (disable : 4624) in the header
file has the undesirable side effect of inhibiting the warning for unrelated
classes.


.



Relevant Pages

  • Re: Virtual destructors are unique virtuals right
    ... The destructor of a derived class does not call the ... >> of its base class, regardless of whether the base class has a virtual ... constructor for the BaseClass, then calls the constructor for the ... DerivedClass. ...
    (comp.lang.cpp)
  • Re: virtual destructor
    ... To get a base class pointer to call a derived class method, ... if the Derived Class constructor creates resources. ... If the base class destructor is NOT virtual, ...
    (comp.lang.cpp)
  • Re: Inheriting from STL bitset
    ... > baseclass destructor explicitly in my derived class? ... Virtual destructor is needed when you delete an object ... of derived class using a base class pointer. ...
    (comp.lang.cpp)
  • Re: Virtual destructors are unique virtuals right
    ... The destructor of a derived class does not call the ... >> of its base class, regardless of whether the base class has a virtual ... The derived class destructor always calls the base class ...
    (comp.lang.cpp)
  • Re: Odd behavior, vector member, MFC and consol app
    ... someone call the base class destructor which then ended up doing something bad. ... it should have no virtual functions at all. ... A good clue that a class is not intended for derivation is the absence ...
    (microsoft.public.vc.mfc)