#include <iostream>
using namespace std;
class Time
{
public:
Time(int h=0,int m=0):hour(h),minute(m){}
~Time(){}
Time(const Time &T){hour=T.hour;minute=T.minute;cout<<"调用了构造函数"<<endl;}
void display(){cout<<hour<<":"<<minute<<endl;}
private:
int hour;
int minute;
static int sec;
};
int Time::sec=0;
void add1(Time t);
Time add2(Time t);
void add3(Time *t);
void add4(Time &t);
int main()
{
Time time1;
Time time2=time1;
cout<<endl;
Time time3;
time3=time2;
add1(time2);
cout<<endl;
add2(time2);
cout<<endl;
add3(&time2);
cout<<endl;
add4(time2);
cout<<endl;
return 0;
}
void add1(Time t){}
Time add2(Time t){return t;}
void add3(Time *t){}
void add4(Time &t){}
结果
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/8bf72bf40edf315182a2d572dd753769.png)