Hi,
I want B has all the constructors that A has. Obviously, the code
below would not work. I could define a corresponding B's constructor
for each A's constructor. But if A has many constructors, it would be
inconvenient. I'm wondering if there is any way to inherent all A's
constructor implicitly.
Thanks,
Peng
class A{
public:
A(int x) : _x(x) { }
private:
int _x;
};
class B : public A { };
I want B has all the constructors that A has. Obviously, the code
below would not work. I could define a corresponding B's constructor
for each A's constructor. But if A has many constructors, it would be
inconvenient. I'm wondering if there is any way to inherent all A's
constructor implicitly.
Thanks,
Peng
class A{
public:
A(int x) : _x(x) { }
private:
int _x;
};
class B : public A { };
Comment