C ++ programming error/warning analysis (1) cannot have CV-qualifier
- Author: Liu Da-poechant (Zhong Chao)
- Email: zhongchao. USTC # gmail.com (#-> @)
- Blog: blog.csdn.net/poechant
- Date: May 9Th, 2012
Explanation
There cannot be a CV qualifier. In C ++, the CV qualifier refersconst
Andvolatile
.
In C ++, normal functions (non-class member functions) cannot have CV restrictions, that isconst
Andvolatile
Limitation. That is, the number of non-class member rows.const
Modify:
Int test () const // This is incorrect. Normal Functions (non-member functions cannot have CV constraints) {// implement}
In C ++, static member functions (static
Member functions) cannot have CV restrictions, that isconst
Andvolatile
Limitation. That is, the static member functions of the class cannot have CV constraints:
Class test {public: static int test_fun () const; // This is not allowed .}
Reference
- Http://blog.163.com/xychenbaihu@yeah/blog/static/132229655201149281131/
-
Liu Da-poechant: blog.csdn.net/poechant
-