Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Re: When is virtual fn def in base cls required?

Thread Tools

Re: When is virtual fn def in base cls required?

Norbert Riedlin
Posts: n/a
**** Post for FREE via your newsreader at ****

"Dick Bridges" <(E-Mail Removed)> schrieb im Newsbeitrag
news:3ef87b65$(E-Mail Removed)...
> 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
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Abend with cls.__repr__ = cls.__str__ on Windows. J Peyret Python 10 03-19-2011 07:09 AM
Is there a way to use "def" to do the job of "def initialize"? Sean Ross Ruby 3 12-25-2003 04:59 AM
HttpModule -- how to intercept urls like http://localhost/abc/def or http://localhost/abc/def/ where abc, def are non virtual dir Jiong Feng ASP .Net 0 11-19-2003 05:29 AM
Re: When is virtual fn def in base cls required? Josephine Schafer C++ 0 06-25-2003 06:29 AM
Re: When is virtual fn def in base cls required? Victor Bazarov C++ 0 06-24-2003 04:48 PM