是么时候产生constructor

// hhtest.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include <iostream>

using namespace std;

class fa
{
public:
    fa()
    {
        cout<<"i am fa"<<endl;
    }
};

class son:public fa
{
public:
    son(int a)
    {
        cout<<"i am son"<<endl;
    }
};



int _tmain(int argc, _TCHAR* argv[])
{

    //son ss;//错误    1    error C2512: “son”: 没有合适的默认构造函数可用,没有任何constructor时才产生
    son sss(5);


    getchar();

    return 0;
}

posted on 2010-11-02 16:01  ATAK  阅读(149)  评论(0编辑  收藏  举报

导航