Accessing private members

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;
};

Any help appreciated.

Read up on the rules of what parts of a base class a derived class can access.

http://www.cplusplus.com/doc/tutorial/inheritance/
Topic archived. No new replies allowed.