On 21 Nov 1999, Masaharu Goto wrote:
> I guess you can not make destructor 'pure' virtual because you can not
> avoid calling it if you ever destroy the object. Unlike other functions,
> base class destructor is called whenever base class object is destructed.
> Derived class destructor does not override base class one. It is executed
> after derived class destructor. Please change your declaration as follows.
> virtual ~A() { }
Hello,
As far as I understand, the C++ standard allows pure virtual destructors,
but enforces a definition (as of the 1996 draft):
12.4.7 A destructor can be declared virtual (_class.virtual_) or pure
virtual (_class.abstract_); if any objects of that class or any
derived class are created in the program, the destructor shall be
defined. If a class has a base class with a virtual destructor,
its destructor (whether user- or implicitly- declared) is virtual.
Would
------------------------------------------------------------------------
virtual ~A() = 0;
...
};
A::~A() {}
------------------------------------------------------------------------
work, too?
Best regards
Christoph
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:43 MET