C++ Programming Error/Warning Analysis (1) cannot have cv-qualifier
C++ Programming Error/Warning Analysis (1) cannot have cv-qualifier
- Author:柳大·Poechant(鍾超)
- Email:zhongchao.ustc#gmail.com (# -> @)
- Blog:Blog.CSDN.net/Poechant
- Date:May 9th, 2012
Explanation
不能有 CV 限定符,在 C++ 中 CV 限定符指const
和volatile
。
- 非成員函式
在 C++ 中,普通函式(非類的成員函式)不能有 CV 限定,即const
和volatile
限定。即非類的成員行數,用const
進行修飾:
int test() const //這是不對的,普通函式(非成員函式不能有CV約束)
{
//實現
}
- 靜態函式
在 C++ 中,靜態成員函式(static
成員函式)不能有 CV 限定,即const
和volatile
限定。即類的靜態成員函式,也不能有 CV 約束:
class Test
{
public:
static int test_fun() const; //這個是不允許的。
}
Reference
- http://blog.163.com/xychenbaihu@yeah/blog/static/132229655201149281131/
-
柳大·Poechant:Blog.CSDN.net/Poechant
-
相關文章
- C++ Programming Error/Warning Analysis (2) extra qualificationC++Error
- configure: error: C++ compiler cannot create executablesErrorC++Compile
- Warning: Cannot redeclare function_name()Function
- dedecms 搬家 / dedecms error warning!錯誤Error
- Uncaught Error: Cannot instantiate interfaceError
- ‘error: ‘‘this‘‘ cannot be implicitly captured in this context‘ErrorAPTContext
- 如何解決"You have an error in your SQL syntax"ErrorSQL
- React報錯之Function components cannot have string refsReactFunction
- VM warning: INFO: OS::commit_memory Cannot allocate memoryMIT
- error: invalid type argument of unary ‘*‘ (have ‘int‘) *__first = __tmp;Error
- Fatal error: Cannot redeclare printerror() (previously declared in …Error
- ERROR: Cannot uninstall ‘PyYAML‘. It is a distutils installed project and thus we cannot accuratelyErrorYAMLProject
- Git (gnome-ssh-askpass:3871): Gtk-WARNING **: cannot open display:Git
- Warning: Cannot send session cookie - headers already sent 解決SessionCookieHeader
- 萬能方法解決——You have an error in your SQL syntaxErrorSQL
- xtrabackup: Error: cannot open /../../base/xtrabackup_checkpointsError
- Import Error: cannot import name ‘export_saved_modelImportErrorExport
- react.js:3640 Warning: Each child in an array or iterator should have a unique "key" prop. Check the...ReactJS
- error while loading shared libraries: libcap.so.1: cannot open sharedErrorWhile
- O/S-Error: (OS 33) The process cannot access the fileError
- LightDB Canopy 常見報錯問題分析(二)DETAIL: Distributed relations cannot haveAI
- Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQLMySqlJDBCExceptionError
- ERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default valueError
- 織夢提示dedecms error warning錯誤的解決方法Error
- The C++ Programming Language, 4th Edition出版了C++
- RBE104TC C/C++ Programming LanguageC++
- Error: Cannot find configuration directory: /etc/hadoopErrorHadoop
- PHP報錯:?configure: error: Cannot find libmysqlclientPHPErrorIBMMySqlclient
- FILE ON OCFS CANNOT BE DELETED LINUX ERROR: 16: DEVICE OR RESOURCE BUSYdeleteLinuxErrordev
- error C2248: cannot access protected member declared in class '****'Error
- Error: cannot fetch last explain plan from PLAN_TABLEErrorASTAI
- 思考c++程式設計-譯自c++ programming language 1.7節 (轉)C++程式設計
- 360 Atals:Cause: java.sql.SQLException: Proxy Warning - near “status“: syntax errorJavaSQLExceptionError
- 機器學習策略篇:詳解進行誤差分析(Carrying out error analysis)機器學習Error
- "Principles of Reactive Programming" 之<Actors are Distributed> (1)React
- Thread 1 cannot allocate new logthread
- Bjarne Stroustrup(BS)博士在 The C++ Programming Language(Special Edition)中對讀者的忠告1(摘抄) (轉)JARC++
- PHP Fatal error: Cannot use PhpParser\Node\Scalar\String as StringPHPError