爱立信从兴c++笔试题
求输出的结果
#include
using namespace std;
class Base
{
public:
void func(const char* str){cout << "Base: " << str << endl;}
virtual void func(int num){cout << "Base: " << num << endl;}
};
class Derived : public Base
{
public:
void func(const char* str){cout << "Derived: " << str << endl;}
void func(int num){cout << "Derived: " << num << endl;}
void func(){cout << "The Function is in Derived!" << endl;}
};
int main()
{
Base *pB;
Derived ObjD;
pB = ObjD;
pB->func(11);
pB->func("Hello");
// pB->func();
getchar();
return 0;
}
版权声明:此文自动收集于网络,若有来源错误或者侵犯您的合法权益,您可通过邮箱与我们取得联系,我们将及时进行处理。
本文地址:https://www.gunzhua.com/jiuye/bishi/98792.html