#ifndef MYTIME3_H_
#define MYTIME3_H_
#include
using namespace std;
class Time
{
private:
int hours;
int minutes;
public:
Time();
Time(int h,int m=0);
void AddMin(int m);
void AddHr(int h);
void Reset(int h=0,int m=0);
Time operator+(const Time & t) const;
friend Time operator+(const Time & t1,const Time & t2);
friend Time operator-(const Time & t1,const Time & t2);
friend Time operator*(double n,const Time & t);
friend ostream & operator<<(ostream & os,const Time & t);
};
这是项目的头文件,编译时提示内部编译错误,是什么原因?
友元必须先声明啊
友元函数需要在同一文件(这里为库)中定义