我的班级extPersonType
继承自其他 3 个班级。该程序编译没有错误,但由于某种原因字符串relation
并phoneNumber
没有显示出来。我要求的所有其他信息都可以。我的问题在哪里?
class extPersonType: public personType, public dateType, public addressType
{
public:
extPersonType(string relation = "", string phoneNumber = "", string address = "", string city = "", string state = "", int zipCode = 55555, string first = "", string last = "",
int month = 1, int day = 1, int year = 0001)
: addressType(address, city, state, zipCode), personType(first, last), dateType (month, day, year)
{
}
void print() const;
private:
string relation;
string phoneNumber;
};
void extPersonType::print() const
{
cout << "Relationship: " << relation << endl;
cout << "Phone Number: " << phoneNumber << endl;
addressType::print();
personType::print();
dateType::printDate();
}
/*******
MAIN PROGRAM
*******/
int main()
{
extPersonType my_home("Friend", "555-4567", "5142 Wyatt Road", "North Pole", "AK", 99705, "Jesse", "Alford", 5, 24, 1988);
my_home .extPersonType::print();
return 0;
}