Inheritance and re-writing functions
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?
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;}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement