为什么派生类中的重写函数隐藏基类的其他重载?
#include <stdio.h>class Base {public:
virtual void gogo(int a){
printf(" Base :: gogo (int) \n");
};
virtual void gogo(int* a){
printf(" Base :: gogo (int*) \n");
};};class Derived : public Base{public:
virtual void gogo(int* a){
printf(" Derived :: gogo (int*) \n");
};};int main(){
Derived obj;
obj.gogo(7);}>g++ -pedantic -Os test.cpp -o test test.cpp: In function `int main()': test.cpp:31: error: no matching function for call to `Derived::gogo(int)' test.cpp:21: note: candidates are: virtual void Derived::gogo(int*) test.cpp:33:2: warning: no newline at end of file >Exit code: 1
炎炎设计
蛊毒传说