test.cpp
Код: Выделить всё
class A
{
public:
virtual int U() {return 0;}
virtual int U(int n) {return n;}
};
class B: public A
{
public:
int U() {return U(1)+U(2);}
};
class C: public B
{
public:
int U(int n) {return n*n;}
};
int main(void)
{
C c;
return c.U();
}
Код: Выделить всё
test.cpp: In member function `virtual int B::U()':
test.cpp:11: error: no matching function for call to `B::U(int)'
test.cpp:11: error: candidates are: virtual int B::U()
test.cpp:11: error: no matching function for call to `B::U(int)'
test.cpp:11: error: candidates are: virtual int B::U()
test.cpp: In function `int main()':
test.cpp:24: error: no matching function for call to `C::U()'
test.cpp:17: error: candidates are: virtual int C::U(int)