首页 > 其他 > 详细

Template Function

时间:2017-02-15 00:35:55      阅读:108      评论:0      收藏:0      [点我收藏+]
// TemplateFunction.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

template<typename T>
T MyMax(T a,T b)
{
    return a>b ? a : b;
}

int main(int argc, char* argv[])
{
    int i=MyMax<int>(1,3);
    int j=MyMax(1,0);
    printf("%d\n%d\n",i,j);
    return 0;
}

// 3
// 1
// Press any key to continue

 

Template Function

原文:http://www.cnblogs.com/sky20080101/p/6399697.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!