![]() |
Re: When is virtual fn def in base cls required?
**** Post for FREE via your newsreader at post.usenet.com ****
"Dick Bridges" <dbridges@codecomplete.com> schrieb im Newsbeitrag news:3ef87b65$1_1@Usenet.com... > 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. Consider: 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 link). HTH Norbert -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= *** Usenet.com - The #1 Usenet Newsgroup Service on The Planet! *** http://www.usenet.com Unlimited Download - 19 Seperate Servers - 90,000 groups - Uncensored -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= |
| All times are GMT. The time now is 05:46 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.