C++ 调用父构造函数时参数多于子构造函数';在c++;

C++ 调用父构造函数时参数多于子构造函数';在c++;,c++,inheritance,C++,Inheritance,在上面的类中,父类获得的数据成员比子类多,但许多成员函数将从父类继承。我不知道是否有办法调用参数比子构造函数多的父构造函数。子构造函数可以为附加参数提供所需的任何值,例如: class Parent{ public: Parent(string a, int i, int j, int k): name(a), num1(i), num2(j), num3(k){} ~Parent(){} ... //other member functions ... protected: string a;

在上面的类中,父类获得的数据成员比子类多,但许多成员函数将从父类继承。我不知道是否有办法调用参数比子构造函数多的父构造函数。

子构造函数可以为附加参数提供所需的任何值,例如:

class Parent{
public:
Parent(string a, int i, int j, int k): name(a), num1(i), num2(j), num3(k){}
~Parent(){}
...
//other member functions
...
protected:
string a;
int num1, num2, num3;
};

class Child : public Parent{
public:
Child(string a, int i, int j): Parent(???){}  //how should I initialise the base class?
~Child(){}
....
//other member funcitions
....
}

子项可以为附加参数提供所需的任何值,例如:

class Parent{
public:
Parent(string a, int i, int j, int k): name(a), num1(i), num2(j), num3(k){}
~Parent(){}
...
//other member functions
...
protected:
string a;
int num1, num2, num3;
};

class Child : public Parent{
public:
Child(string a, int i, int j): Parent(???){}  //how should I initialise the base class?
~Child(){}
....
//other member funcitions
....
}

为参数指定默认值。为参数指定默认值。