C++模板中的静态
来源:互联网 发布:js或 编辑:程序博客网 时间:2024/05/29 19:07
#include <iostream>#include <stdlib.h>using namespace std;template<class T>class xiaok{public: static void han(){cout<<"xiao"<<endl;} static void han1(); static int i; // static const int ii=0; //vc.6报错};int xiaok<int>::i=1;int xiaok<char>::i=2;template<class T> int xiaok<T>::i=0;void xiaok<int>::han1(){cout<<"int"<<endl;}void xiaok<char>::han1(){cout<<"char"<<endl;}template<class T> void xiaok<T>::han1(){cout<<"T"<<endl;}int main(int argc, char const *argv[]){xiaok<int> wi;xiaok<char> wc;xiaok<long> wl;cout<<xiaok<int>.i<<endl;cout<<wc.i<<endl;cout<<xiaok<long>.i<<endl;wi.han1();xiaok<char>::han1();wl.han1();wl.han();return 0;}
0 0
- C++模板中的静态
- C++/Java__中类模板中的静态成员变量和静态成员函数
- C中的静态变量
- C中的静态库
- C++模板类中的静态成员函数
- C++模板类中的静态成员函数
- C++模板类中的静态成员
- C#(asp.net)根据静态模板生成静态(html)页面
- C语言中的静态函数
- Objective-C中的静态变量
- C语言中的静态变量
- c语言中的静态变量
- C++---类中的静态成员
- C/C++中的静态数据和静态函数的用法
- C|C++中的静态全局变量,静态局部…
- C语言中的静态变量和非静态变量
- [c++] c++ 类中的静态变量初始化
- C语言中的静态函数的作用
- OC学习中的好的链接推荐
- NGS项目四:高通量测序在植物生物胁迫研究中的应用
- 折半查找
- python 2 给我自己看
- NYOJ 47 过河问题
- C++模板中的静态
- dfsd
- wamp 中安装cakephp Fatal error: You must enable the intl extension to use CakePHP. in XXX
- Robbers
- Protecting the Flowers
- ACdream的高速公路
- 二进制暴力
- Packets
- Statistics of Recompre…