求解为什么time1出错?
#include<iostream>using namespace std;
class Time
{
public:
Time(int hour=0,int min=0,int sec=0);
int compute();
int hour;
int min;
int sec;
};
Time::Time(int h,int m,int s)
{
hour=h;
min=m;
sec=s;
}
int Time::compute()
{
return(hour*min*sec);
}
int main()
{
Time time1();
cout<<"The hour is:"<<time1.hour<<endl;
Time time2(6,2,4);
cout<<"The hour is:"<<()<<endl;
Time time3(1,2,3);
cout<<"The hour is:"<<()<<endl;
system("pause");
}