[Exceptional C++ Style] Item 18 - Virtuality

Paul Grenyer paul at paulgrenyer.co.uk
Tue Jan 4 08:30:23 EST 2005


Hi

> >//A modern base class, using Nonvirtual Interface
> >//(NVI) to separate interface from internals.
> >class Widget
> >{
> >public :
> > //Stable, nonvirtual interface.
> > //
> > intProcess( Gadget& ); // uses DoProcess()
> > bool IsDone();         // uses DoIsDone()
> > //
> >private :
> > virtual intDoProcessPhase1( Gadget& );
> > virtual intDoProcessPhase2( Gadget& );
> > virtual bool DoIsDone()
> > //
> >};
> >
> >

(snip)

> Is  this is the actual code from Herb's book? I hope not.

Yes.

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