RE:Pure virtual destructors in abstract

From: Masaharu Goto (MXJ02154@nifty.ne.jp)
Date: Tue Nov 23 1999 - 11:40:07 MET


Hello Christoph,

Thank you for quote from ANSI/ISO draft. Indeed, pure virtual destructor 
is not prohibited in the standard. The problem is compiled code complains
from it. It will be annoying for ordinary users for finding out strange
undefined symbol.  In cint, I will display warning message for pure virtual
desctructor so that users can get a hint.

Thank you
Masaharu Goto

>
>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