As you can see, I intend to call the constructor of parent class in the child class, because there is no need to duplicate the code here. But compiler gives me warning says "declaration of 'intSet input' shadows a parater."Code:#include <string> using namespace std; class intSet{ protected: int integer[10]; int numOfInts; public: intSet(){ for (int i=0; i<10; i++){ integer[i]=0; } numOfInts=10; } intSet(int arg[]){ for (int i=0; i<10; i++){ integer[i]=arg[i]; } numOfInts=10; } int getIndexOf(int index){ return integer[index]; } }; class maxIntSet: intSet{ public: maxIntSet(int input[]){ intSet(input); // I intend to call the constructor of parent class } int getMaxInt(){ int tempMax=integer[0]; for (int i=0; i<10; i++){ if (integer[i]>tempMax) tempMax=integer[i]; } return tempMax; } };
so what's the correct way to call parent class constructor?
Thanks.