cannot have cv-qualifier
11 Feb 2013C: const V: volatile
说明:在C++中
- 非成员函数不能有CV限定
- 静态成员函数不能有CV限定
例子:
- 第一种情况:非成员函数不能有CV限定
#ifndef _HEAD_H
#define _HEAD_H
class A {
public:
static void print() const; //错误
};
#endif //_HEAD_H
- 第二种情况:静态成员函数不能有CV限定
#ifndef _HEAD_H
#define _HEAD_H
void print() const; //错误
#endif //_HEAD_H