这个程序为什么会出错 ?
#include <iostream>using namespace std;
template<class numtype>
class Compare
{
public:
Compare(numtype xx,numtype yy):x(xx),y(yy){}
numtype max();
numtype min();
private:
numtype x,y;
};
numtype Compare::max()
{
return ((x>y)?x:y);
}
numtype Compare::min()
{
return ((x>y)?y:x);
}
void main()
{
Compare<float> ci(1.22,2,4);
cout << ci.max() << endl;
cout << ci.min() << endl;
}