美文网首页
60 - class Templates

60 - class Templates

作者: 社交帐号直接注册 | 来源:发表于2018-01-08 19:17 被阅读0次
#include <iostream>
using namespace std;

template<class t>
class bucky
{
    t first,second;
public:
    bucky(t a,t b)
    {
        first=a;
        second=b;
    }
    t bigger();
};

template<class t>
t bucky<t>::bigger()
{
    return (first>second?first:second);
}
int main()
{
    bucky<int>bo(69,105);
    cout << bo.bigger();
}

相关文章

网友评论

      本文标题:60 - class Templates

      本文链接:https://www.haomeiwen.com/subject/vqtinxtx.html