64,649
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
using namespace std;
class Base
{
public:
virtual void Print(); //加=0是纯虚接口。
protected:
private:
};
void Base::Print()
{
cout << "base" << endl;
}
class Child:public Base
{
public:
Child()
{
};
void Print1()//必须为Print
{
cout << "hello,world" << endl;
Base::Print();
};
protected:
private:
};
int main(int argc, char* argv[])
{
Child c;
c.Print1();
return 0;
}