father and son

来源:互联网 发布:ugui 源码下载 编辑:程序博客网 时间:2024/05/14 11:37

#include <iostream>
using namespace std;

class badguy
{
public:
    badguy()
    {
        cout<<"badguy::badguy()"<<endl;
       
    }
};

class father
{
public:
    father()
    {
        cout<<"father::father()/n";
        //virfun();
    }
    /*virtual virfun()
    {
        cout << "father virtual fun()/n";
    }*/
    badguy g;
};

class son : public father
{
public:
    son()
    {
        cout<<"son::son()/n";
    }
    badguy g;
    /*virtual virfun()
    {
        cout << "son virtual fun()/n";
    }*/
};

int main()
{
    son* p = new son();
    int stop;
    cin>>stop;
    return 0;
}

 

badguy::badguy()

father::father()

badguy::badguy()

son::son()

原创粉丝点击