Thanks for the help guys!
I tried to use the code that skater posted but I was still getting errors. After thinking about it for a minute, I realized that it was pointless to make a time object since an extTime object would have the inheritance of time. I tweaked it a bit and got it to work. Thanks for the help guys!
CODE
#include <iostream>
#include <string>
using namespace std;
class time
{
public:
time();
int getHour();
int getMinute();
int addHour();
int addMinute();
void printTime();
private:
int hour, minute;
};
class extTime : public time
{
public:
extTime();
string getTimeZone();
void printTimeZone();
private:
string timeZone;
};
time::time():hour(0), minute(0)
{
}
int time::getHour()
{
cout << "Please enter the hour: ";
cin >> hour;
return hour;
}
int time::getMinute()
{
cout << endl << "Please enter two digits for the minutes: ";
cin >> minute;
return minute;
}
int time::addHour()
{
++hour;
return hour;
}
int time::addMinute()
{
++minute;
return minute;
}
void time::printTime()
{
cout << endl << "The time is " << hour << ":" << minute << ".";
}
extTime::extTime():timeZone("abc")
{
}
string extTime::getTimeZone()
{
cout << endl << "Please enter the time zone abreviation: ";
cin >> timeZone;
return timeZone;
}
void extTime::printTimeZone()
{
cout << endl << endl << "The Time Zone is " << timeZone << "." << endl << endl;
}
int main()
{
extTime userExtTime;
userExtTime.getHour();
userExtTime.getMinute();
userExtTime.getTimeZone();
userExtTime.printTime();
userExtTime.printTimeZone();
system("PAUSE");
return 0;
}