请问我怎样才能用类声明之外的参数编写构造函数的定义?
class A{
public:
A(int x);
~A();
}
A::A(int x) { ... }
A::~A(){...}
class B : public A
{
public:
B(int x):A(x){ this work fine}
~B(){}
}
这行不通
class B : public A
{
public:
B(int x):A(x); // error here
~B();
}
B::B(int x):A(x){ this not work };
B::~B();