关于类中static const变量的使用
#include<iostream>
using namespace std;
class base
{
public:
static const int vs=3;
};
void main()
{
cout<<base::vs<<endl;
}
编译不能通过
信息:e:\visualstudiocode\trystatic\main.cpp(6) : error C2258: illegal pure syntax, must be '= 0'
e:\visualstudiocode\trystatic\main.cpp(6) : error C2252: 'vs' : pure specifier can only be specified for functions
所用编译器VC6.0
thinking inC++上说这样是可以的
请高手指点
谢谢