Inheritance and re-writing functions

Started by
1 comment, last by Nemesis2k2 18 years, 9 months ago
If I have a class that inherits from another with virtual functions, if I intend to re-write those functions in the derived class to have the more specialized functionality, do I have to put the function prototypes of the derived functions in the derived class declaration?
[size="2"][size=2]Mort, Duke of Sto Helit: NON TIMETIS MESSOR -- Don't Fear The Reaper
Advertisement
Yes. The following code will give you a compile error

class A {public:   virtual int foo() {      return 5;   }};class B : public A { };int B::foo() {   return 6;}
Yes.

This topic is closed to new replies.

Advertisement