Chinaunix首页 | 论坛 | 博客
  • 博客访问: 152060
  • 博文数量: 53
  • 博客积分: 2059
  • 博客等级: 大尉
  • 技术积分: 490
  • 用 户 组: 普通用户
  • 注册时间: 2009-09-14 20:25
文章分类
文章存档

2012年(1)

2011年(25)

2010年(16)

2009年(11)

我的朋友

分类: LINUX

2010-11-14 15:00:38

#include<iostream>
using namespace std;
template <typename T>
class testClass
{
public:
        static const int _test1=5;
        static const long _test2=3L;
        static const char _test3='c';
};
int main(int argc, char *argv[])
{
        cout<<testClass<int>::_test1<<endl;
        cout<<testClass<int>::_test2<<endl;
        cout<<testClass<int>::_test3<<endl;
}

静态常量在类的内部初始化
阅读(546) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-11-16 15:28:40

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com