类中static const 声明与使用?该如何处理

类中static const 声明与使用?
在c++ primer书中看到了如下声明:在类中声明 static const int CINLIM=80;
这样做可以吗?如果可以怎么使用它?[code=C/C++][/code]
class String
{
private:
char *str; //pointer to string
int len; //length of string
static int num_strings; //number of objects

  static const int CINLIM=80;//cin input limit
public:
//constructions and other methods
String(const char *s);//constructor
String(); //default(默认)constructor
String(const String &);//copy constructor
~String(); //destructor
int length()const{return len;}
//overload operator methods
String & operator=(const String &);//引用
String & operator=(const char *);//按值传递
char & operator[](int i);
const char & operator[](int i)const;
//over loaded operator friends
//我们应该尽量考虑使用const当然你的明白使用这个将有什么好处才使用!
friend bool operator<(const String &st1,const String &st2);
friend bool operator>(const String &st1,const String &st2);
friend bool operator==(const String &st1,const String &st2);
//oveloaded cout and cin为对象的输入输出提高便捷的方式,这样只是更让你接近你的想法,
//作为程序员你还是应该明白程序是如何运作的。
friend ostream & operator<<(ostream & os,const String & st);
friend istream & operator>>(istream & is,const String & st);
//static function
static int HowMany();
};



在重装函数中这样使用这个变量:
istream & operator>>(istream & is, const String &st)
{
char temp[String::CINLIM];
is.get(temp,String::CINLIM);
if(is)
st=temp;
while(is&&is.get()!='\n')
continue;
return is;
}
但为什么运行不了?
出现如下错误:
d:\visual c++6.0\msdev98\myprojects\string1\string1.h(16) : error C2258: illegal pure syntax, must be '= 0'
d:\visual c++6.0\msdev98\myprojects\string1\string1.h(16) : error C2252: 'CINLIM' : pure specifier can only be specified for functions
执行 cl.exe 时出错.

sayings1.obj - 1 error(s), 0 warning(s)


------解决方案--------------------
istream & operator>>(istream & is, const String &st)
{
 char temp[String::CINLIM];
 is.get(temp,String::CINLIM);
 if(is)
 st=temp; //const变量,值不能改变
 while(is&&is.get()!='\n')
 continue;
 return is;
}

------解决方案--------------------
const 、static都是限定词
const 表示所修饰的对象不能被改变
static 分几中情况。
1。限定定义类成员时表明该成员是所有该类对象共享的,只有一个,而不属于某个特定的对象。所以要这样引用 classname::varname;
2。限定非类成员的变量时,只定义一次,忽略重复的定义。相当于全局变量,如:
for (int i = 0; i < 10; ++i)
{
static int temp = 0;
temp++;
}
执行后temp = 10;

const static 与 static const 相同,意义就是把2者结合起来理解
------解决方案--------------------
static const int CINLIM=80;
这里只能申明static const int CINLIM;
要在CPP文件里写,const int String::CINLIM = 80;