[Exceptional C++ Style] Item 18 - Virtuality

Paul Grenyer paul at paulgrenyer.co.uk
Tue Jan 4 07:23:15 EST 2005


Hi

> Other things from the original - I've always found the DoXXXX naming
> slightly icky , but haven't found anything better. Given you need two
> names, and they ought to have the main bit in common, I think you need a
> wart like "Do" or "Impl" or a trainling underscore. Suggestions welcome.

Yes. Coming up with names is a problem I have mentioned I have several times
in the past. Even when I decide on a convention for this sort of thing it
often looks wrong to me afterwards.

> And the final guideline:
> "Guideline: A base class destructor should be either
> public and virtual, or protected and nonvirtual."
>
> and
>
> "Herb suggests that an empty but protected destructor should be given to
> classes like std::unary_function."
>
> I didn't think it was really clear that this only applies to classes that
> are *never* instantiated, but only used as base classes.

I thought it was clear, because the guideline specifically uses the term
"base class".

Regards
Paul

Paul Grenyer
email: paul at paulgrenyer.co.uk
web: http://www.paulgrenyer.co.uk
articles: http://www.paulgrenyer.dyndns.org/articles/

Darrell "Dimebag" Abbott will be sorely missed.




More information about the Effective-cpp mailing list