
13 Oct
2006
13 Oct
'06
12:12 a.m.
Caleb Epstein wrote:
On 10/12/06, Arkadiy Vertleyb <vertleyb@hotmail.com> wrote:
More importantly, according to the standard, the basic_string class destructor is not virtual, and so basic_string is not intended for derivation.
Wouldn't this only matter if super_string added data members (it doesn't AFAICT) and was being deleted via pointers to std::basic_string?
Yes, not having any data members in the subclass makes the destructor a no-op. Someone has pointed out that *technically* the behavior is undefined by the standard. But in reality what happens is, well, nothing. The empty subclass destructor is not called -- so there is no effect. It works on all C++ compilers that I'm aware of. Jeff