标签:教材 ima iostream public ret class png names base
源程序:
#include <iostream>
using namespace std;
class Base
{
public:
virtual void fun()
{
cout << "Base::fun()" << endl;
}
};
class Derived :public Base
{
public:
virtual void fun()
{
cout << "Derived::fun()" << endl;
}
};
void FunTest()
{
Base b;
Derived d;
b.fun();
d.fun();
}
int main()
{
FunTest();
system("pause");
return 1;
}
运行结果:
标签:教材 ima iostream public ret class png names base
原文地址:https://www.cnblogs.com/duanqibo/p/12261981.html