读程序写结果_2
作者:互联网
源程序:
#include <iostream>
using namespace std;
class Based
{
public:
Based()
{
cout<<"Based构造函数\n";
fun();
}
virtual void fun()
{
cout<<"Base::fun()函数\n";
}
};
class Derived:public Based
{
public:
Derived()
{
cout<<"Derived构造函数\n";
fun();
}
void fun()
{
cout<<"Derived::fun()函数\n";
}
};
void main()
{
Derived d;
}
运行结果 :
标签:Based,cout,结果,程序,void,Derived,fun,public 来源: https://www.cnblogs.com/duanqibo/p/16030019.html