首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

种模板的特化,局部化以及缺省模板的实参

2012-09-21 
类模板的特化,局部化以及缺省模板的实参// 泛型编程.cpp : 定义控制台应用程序的入口点。//#include stdaf

类模板的特化,局部化以及缺省模板的实参

// 泛型编程.cpp : 定义控制台应用程序的入口点。//

#include "stdafx.h"#include <iostream>using namespace std;

//类模板template <class T>class CC{public: void hh(T itemp){} void pp(T kk){}};//类模板的特化template<>class CC<std::string>{public: void hh(std::string pp){}};

//类模板template<typename t1, typename t2>class BB{public: BB() {  cout << "BB cons" << endl; } };//类模板的局部化template <typename T>class BB<T, T>{public: BB() {  cout << "local BB cons" << endl; }};//类模板的缺省实参template <class T, typename AINT = int>class AA{public: AA();};

AA<class T,  int>::AA(){

};

 

int _tmain(int argc, _TCHAR* argv[]){ BB<int, int> ibb; getchar(); return 0;}

 

热点排行