关于一个类模板的程序,请高手帮帮忙哈
#include<iostream>
using namespace std;
template<class type>
class Time
{
public:
Time(type a,type b,type c,type d,type e,type f)
{
hour=a;
minute=b;
sec=c;
month=d;
day=e;
year=f;
}
void display();
private:
type hour;
type minute;
type sec;
type month;
type day;
type year;
};
/*Time::Time<type>(type a,type b,type c,type d,type e,type f)
{
hour=a;
minute=b;
sec=c;
month=d;
day=e;
year=f;
}*/
void Time<type> ::display()
{
cout<<month<<"/"<<day<<"/"<<year<<endl;
cout<<hour<<":"<<minute<<":"<<sec<<endl;
}
int main()
{
Time<int> t1(10,13,56,12,25,2004);
t1.display();
return 0;
}
编译有不少错误,是不是类模板错了,还是类模板外定义函数错了?还是都错了,请高手指点一下哈