I have a case where a derived class cannot see a virtual function defined in a public base class. The only explanation I can come up with is that C++ must have some kind of rule that says if you override a base class function with name "X", then you must override all base class functions having the same name. Is this a rule? See the following example:
Code:class base { public: virtual int func(); virtual void func(int arg1,int arg2); virtual void func2(int arg1,int arg2) { func(arg1,arg2); } }; class derived : public base { public: // override func(), but not func(arg1,arg2) virtual int func(); }; void test { derived xyz; int i = xyz.func(); // compiles OK xyz.func(1,2); // compilation error: "func() does not take two arguments" xyz.func2(1,2); // compiles OK };



LinkBack URL
About LinkBacks


