You can't overload derived functions and still expect the base versions to be called. Inheritance works by nesting the base class within your derived class, so the compiler won't check the inner functions unless it finds no match in the outer. The compiler will find what it thinks is a match in the outer scope and will either try and call that one or issue an error if the parameters don't match.
You'll have to re-declare in the derived class, so you may aswell make both methods pure in the abstract base. -
Code:
#include <iostream>
using namespace std;
class A {
public:
virtual void operator()(float a)=0;
protected:
virtual void operator()(int b) = 0;
};
class B : public A {
public:
void operator ()(float a){cout << a;}
protected:
void operator ()(int b){}
};
int main (){
B t;
t(2.0f);
return 0;
}