Topic: Virtual destructors: required always?


Author: rfg@netcom.com (Ronald F. Guilmette)
Date: Mon, 1 Nov 1993 05:41:55 GMT
Raw View
In article <26929@alice.att.com> ark@alice.UUCP () writes:
>In article <rfgCF3u3K.3Dr@netcom.com> rfg@netcom.com (Ronald F. Guilmette) writes:
>
>> Could you perhaps provide a citation (just to set my mind at rest)?
>
>I do not think it is explicitly stated in the RM.

I can be somewhat more definitive.  I *know* that it is nowhere stated
that given:

 struct B { virtual ~B(); };
 struct D : public B { virtual ~D(); };

the ~D destructor overrides the ~B destructor (just as functions of the same
name in two class types related by inheritance do).

>However, the ARM commentary in Section 12.4 is clear.

I hardly think so.  I do not think that an example which DOES NOT even
show the efefct of such overriding, following by a terse statement that
"Declaring B::~B virtual solves the problem." is adequate to enlighten
the average user regarding this special case overriding rule for
destructors.

--

-- Ronald F. Guilmette, Sunnyvale, California -------------------------------
------ domain address: rfg@netcom.com ---------------------------------------
------ uucp address: ...!uunet!netcom.com!rfg -------------------------------