模板小知识点

来源:互联网 发布:数据库管理阶段的特点 编辑:程序博客网 时间:2024/05/18 00:06

1.

template<class T>

void tmp( T array, int size)
{
    cout<< array<<endl;
    cout<<size<<endl;
}
template <class TT>
void tmpt(TT a, TT b)
{
}
double tmpd = 9;
float tmpf;
char tmpc;
tmp(tmpd,'c');      
//    9
//    99   ‘c’的ASCII码
tmpt(tmpd, tmpf);//编译会出错。找不到匹配模板创建函数
	
				
		
原创粉丝点击