标题:这个程序为什么会出错 ?
取消只看楼主
nala
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2006-9-2
 问题点数:0 回复次数:1 
这个程序为什么会出错 ?
#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;
}
搜索更多相关主题的帖子: private include public 
2006-09-04 20:10
nala
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2006-9-2
得分:0 

呵呵,精辟,在此谢过了

2006-09-06 08:43



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-87985-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.020177 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved