Hi, I am trying to access private level members with a Derived class but keep getting: Error1 cannot access private member declared in class 'TimeType'.
Here is my code for the Base Header file:
.
.
.
class TimeType
{
private:
int hours;
int minutes;
int seconds;
public:
virtual void setTime(int,int,int);
int gethours();
int getminutes();
int getseconds();
TimeType();
bool operator ==(const TimeType&);
bool operator <(const TimeType&);
friend ostream &operator <<(ostream &,const TimeType&);
friend istream &operator >>(istream &,const TimeType&);
};
.
.
.
...and here is my code for the Derived header file:
.
.
.
class extTimeType:public TimeType
{
private:
string timezone;
public:
extTimeType();
void setTimeZone(string);
void setTime(int,int,int,string);
string getTimeZone();
bool operator ==(const extTimeType&);
bool operator <(const extTimeType&);
friend ostream &operator <<(ostream &,const extTimeType&);
friend istream &operator >>(istream &,const extTimeType&);
};
extTimeType::extTimeType()
{
timezone="CPT";
}
ostream &operator <<(ostream &strm, const extTimeType &obj)
{
strm<<obj.hours <====ERROR HERE
<<":"<<obj.minutes <====ERROR HERE
<<":"<<obj.seconds <====ERROR HERE
<<":"<<obj.timezone;
return strm;
};
I have and it results in link errors: Error 1 error LNK2019: unresolved external symbol "public: void __thiscall extTimeType::setTime(int,int,int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?setTime@extTimeType@@QAEXHHHV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _main