Velocity Reviews

Velocity Reviews (
-   C++ (
-   -   Re: When is virtual fn def in base cls required? (

Norbert Riedlin 06-25-2003 12:14 PM

Re: When is virtual fn def in base cls required?
**** Post for FREE via your newsreader at ****

"Dick Bridges" <> schrieb im Newsbeitrag
> I'm having a "senior moment". Can someone point me to a reference that
> describes the circumstances requiring a base class to provide an
> implementation for a pure virtual member function?

One circumstance that I can think of, that hasn't been mentioned is a pure
virtual destructor.

struct pure {
virtual ~pure() = 0;

// implementation:
pure::~pure() {}

struct concrete : pure {

int main()
concrete c;

If pure::~pure had no implementation, you would never have a chance to
inherit from pure and get an instance of this class. In the example above
concrete's destructor (no matter whether explicitly defined or compiler
generated) will call the pure's destructor. If pure::~pure was not
implemented, the program would not compile (well, at least it would not



*** - The #1 Usenet Newsgroup Service on The Planet! ***
Unlimited Download - 19 Seperate Servers - 90,000 groups - Uncensored

All times are GMT. The time now is 07:26 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.