class Time{
//public:
int hour, minute, second;
public:
void set(int h, int m, int s){ hour=h, minute=m, second=s; }
friend Time& operator++(Time& a);
friend Time operator++(Time& a, int);
friend ostream& operator<<(ostream& o, const Time& t);
};
使用自定义类时,编译提示错误:cannot access private member declared in class 'Time'
开始以为类定义时默认是私有变量,加上public,似乎可以解决问题
其实还是没有声明类引起的。