Hi I'm still learning and I have an error that I need some guidance with. I have a base class that I have a constructor in as folllows
class foo { // Base Class
private:
int century, year; // define the members
string firstName, lastName;
public:
foo(int i1, int i2, string s1, string s2){ // Define your constructor with default values
year = i2;
century = i1;
firstName = s1;
lastName = s2;
};
if I then create a derived class do I need to repeat the above constructor with any additional variables I tried just using the following -
class newFoo: public foo{ // Derived Class
private:
int houseNumber;
public:
newFoo(int hn){ // Constructor
houseNumber = hn;
};
I get the following error - error no matching function call to foo:foo()
Any guidance would be greatly appreciated.
Many Thanks
Brian
I tried just adding the new variables and a blank constructor. I don't know if I need to use the original constructor in fill in the derived class.