Velocity Reviews - Computer Hardware Reviews

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

Reply
Thread Tools

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

 
 
Josephine Schafer
Guest
Posts: n/a
 
      06-25-2003

"Dick Bridges" <(E-Mail Removed)> wrote in message
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?
>
> TIA
>
>
>
> Posted Via Usenet.com Premium Usenet Newsgroup Services
> ----------------------------------------------------------
> ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
> ----------------------------------------------------------
> http://www.usenet.com


1 situation I can think of is when many derived classes have the same common
behavior for some function
but some derived classes have a different one.

Say

class Base{
public:
virtual void foo () = 0;
....
};

void Base::foo ()
{
// Some common implementaion
}

class Derived1: public Base{
public:
virtual void foo ();
...
};


void Derived1::foo (){
//Some different implementation

}

class Derived2: public Base{
public:
virtual void foo ();
...
};

void Derived2::foo (){
// Same as base class
Base::foo ();
}





 
Reply With Quote
 
 
 
Reply

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 self.new" 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? Norbert Riedlin C++ 0 06-25-2003 12:14 PM
Re: When is virtual fn def in base cls required? Victor Bazarov C++ 0 06-24-2003 04:48 PM



Advertisments