有关类类型的问题,很是奇怪啊
#include<iostream.h>class clock{
public:
clock(int h,int m,int s)
{
H=h;
M=m;
S=s;
cout<<"constructor"<<H<<":"<<M<<":"<<S<<endl;
}
~clock()
{
cout<<"destructor"<<H<<":"<<M<<":"<<S<<endl;
}
clock(clock &p)
{
H=p.H;
M=p.M;
H=p.S;
}
void showtime()
{
cout<<H<<":"<<M<<":"<<S<<endl;
}
};
clock fun(clock c)
{
return c;
}
int main()
{
clock c1(8,0,0);
clock c2(9,0,0);
clock c3(c2);
fun(c2);
clock c4;这里的定义的对象c4会报错额,但是如果写成clock c4=c2编译器又不会报错啊
c4=c2;
return 0;
}