So I have a class named package with has a bunch of variables. I have all of the get/set methods AND a constructor working.
I have two derived class named twoDay and threeDay that inherit the package class and need to use its constructor.
Constructor for the package class:
package::package(string sN, string sA, string sC, string sS, int sZ, string rN, string rA, string rC, string rS, int rZ, int w, int c) {
this->senderName = sN;
this->senderAddress = sA;
this->senderCity = sC;
this->senderState = sS;
this->senderZip = sZ;
this->receiverName = rN;
this->receiverAddress = rA;
this->receiverCity = rC;
this->receiverState = rS;
this->receiverZip = rZ;
this->weight = w;
this->cpo = c;
}
I've been using this code for the constructor in the threeDay header:
threeDay(string, string, string, string, int, string, string, string, string, int,int,int);
What I need to have happen is to have twoDay and threeDay to be able to use the constructor. What I mean is that the derived packages need to be able to use the base classes constructor.
I currently get this error:
threeDay.cpp:10:136: error: no matching function for call to ‘package::package()’
I did some research from this link: http://www.cs.bu.edu/teaching/cpp/inheritance/intro/
and this link: C++ Constructor/Destructor inheritance
So it seems like I don't directly inherit the constructor, I still need to define it. If that is the case, than why isn't my code working now?
but I just can't seem to get it to work.
Once I get the constructors working, it's smooth sailing from there.