【发布时间】:2010-07-01 09:41:39
【问题描述】:
这是一些 C++ 代码:
#include <iostream>
using namespace std;
class m
{
public:
m() { cout << "mother" << endl; }
};
class n : m
{
public:
n() { cout << "daughter" << endl; }
};
int main()
{
m M;
n N;
}
这是输出:
mother
mother
daughter
我的问题是我不想在创建N的时候调用m的构造函数,我该怎么办?
【问题讨论】:
标签: c++ class inheritance