【发布时间】:2009-05-06 14:35:40
【问题描述】:
我一直在查看一些看起来像这样的代码:
class A; // defined somewhere else, has both default constructor and A(int _int) defined
class B
{
public:
B(); // empty
A a;
};
int main()
{
B* b;
b = new B();
b->a(myInt); // here, calling the A(int _int) constructor,
//but default constructor should already have been called
}
这行得通吗?在调用默认构造函数后调用特定构造函数?
【问题讨论】:
标签: c++ constructor default