[K42-discussion] virtual destructors

Donour Sizemore donour at cs.unm.edu
Sat Jul 8 03:04:01 EST 2006


Michal Ostrowski wrote:
> On Thu, 2006-07-06 at 14:15 -0600, Donour Sizemore wrote:
>   
>> C++ requires that classes with virtual methods define a virtual 
>> destructor. Older versions of gcc allow you to get away without it, but 
>> gcc4 enforces it. I'm having trouble adding a destructor to the 
>> VAllocServices class. I want to declare a destructor like this:
>>
>> VAllocServices{
>>
>> public:
>>
>>   ...
>>
>>   ~VAllocServices() = 0;
>>
>> }
>>
>>     
>
> This has the effect of saying no destructor.  I don't think you can do
> this.
>
>   

My mistake. The previous explanation was correct but my example omitted 
a keyword. That should have been :

virtual ~VAllocServices() = 0;

donour



More information about the K42-discussion mailing list