Inheritance is not as cooperative as I want it to be. All my base classes are fully functioning, tested, but my entryType class will not let me call the print function of any of the other classes. Error:
'personType::printName' : illegal call of non-static member function
This is the same error that originates three times from the line entry[0].printEntry();
This isn't inheritance. This is composition. IE, entryType isn't a child class or anything (that would be inheritance). Instead it just "owns" a few objects of other types.
You call member functions in the form object.function();. Here, address is your object.. so it would be address.printAddress(); (not addresType::printAddress)
Also...
1 2 3 4 5 6
entryType::entryType()
{
/* personType::personType(); // get rid of this crap
dateType::dateType();
addressType::addressType();*/
}
lol I was trying to make the member functions static and just about everything else I wasn't supposed to do. Do you know how long I tried to figure this out? Longer than I want to say.
Thanks for the info Disch.
Not only are they not needed, but they're not doing what you think. They're creating a temporary object (and then destroying it right away). Utterly pointless.
Default constructors (those which take no parameters) are called by default (hence the name). You don't need to worry about explicitly constructing anything unless you want to use a specific ctor... one other than the default.
To elaborate a bit more on what your original problem was (even though it's solved now):
Remember that to call a (nonstatic) member function you need an object. You always have to tell the compiler what object you want to perform the function on.
For instance:
1 2 3
void entryType::printEntry()
{
personType::printName(); // whose name are you trying to print? you never say!
It may seem obvious to you because you only have one personType in your class, the compiler can't make that assumption. What if you have multiple personTypes?