用户名: 密码: 忘记密码? 注册

静态常量初始化

作者:  时间: 2010-11-14

#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;
}

静态常量在类的内部初始化