参考http://blog.youkuaiyun.com/csw_100/article/details/5844615
#include <iostream>
using namespace std;
template <class T>
void func(T a){
cout << a << endl;
}
template <class T>
class A{
public:
A(T a):data(a){}
T data;
void show(){
cout << data << endl;
}
};
int main()
{
//函数模板的实例化是由编译程序在处理函数调用时自动完成的
//函数模板的实例化由编译器实现
//函数模板允许隐式调用和显式调用
func(1);
func<double>(2.3);
//类模板的实例化必须由程序员在程序中显式地指定
A<int> obj(5);
obj.show();
int ttt = 0;
return 0;
}