静态常量初始化

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

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

作者: malcolm_ok   发布时间: 2010-11-14