#include <iostream>
using namespace std;
class type1 {}; class type2{};
class A {
public:
virtual string foo(type1 a){return "A::foo(type1)";}
virtual string foo(type2 a){return "A::foo(type2)";}
};
class B : public A {
public:
virtual string foo(type1 a){return "B::foo(type1)";}
};
int main () {
B* b = new B();
cout << b->foo(type1()) << endl; // WORKS
cout << b->foo(type2()) << endl; // compile error: no matching function for B::foo(type2
}