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
- React報錯之Function components cannot have string refsReactFunction
- Uncaught Error: Cannot instantiate interfaceError
- ‘error: ‘‘this‘‘ cannot be implicitly captured in this context‘ErrorAPTContext
- VM warning: INFO: OS::commit_memory Cannot allocate memoryMIT
- error: invalid type argument of unary ‘*‘ (have ‘int‘) *__first = __tmp;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
- react.js:3640 Warning: Each child in an array or iterator should have a unique "key" prop. Check the...ReactJS
- Import Error: cannot import name ‘export_saved_modelImportErrorExport
- 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
- The C++ Programming Language, 4th Edition出版了C++
- 思考c++程式設計-譯自c++ programming language 1.7節 (轉)C++程式設計
- 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
- "Principles of Reactive Programming" 之<Actors are Distributed> (1)React
- Bjarne Stroustrup(BS)博士在 The C++ Programming Language(Special Edition)中對讀者的忠告1(摘抄) (轉)JARC++
- 360 Atals:Cause: java.sql.SQLException: Proxy Warning - near “status“: syntax errorJavaSQLExceptionError
- Thread 1 cannot allocate new logthread
- PHP Fatal error: Cannot use PhpParser\Node\Scalar\String as StringPHPError
- yum:Error: Cannot retrieve metalink for repository: epel. Please verifyError
- Fatal Error: TXK Install Service,Cannot install Oracle Database HomeErrorOracleDatabase
- ERROR: /etc/ld.so.preload cannot be preloaded: ignoredError
- ?WARNING: ASM communication error: op 0 state 0x0 (15055)ASMError
- Programming Computer Vision with Python Test 1Python
- ora-30004:when using sys_connect_by_path function,cannot have seperator as part of column valueFunction
- linux登入locale告警-bash: warning: setlocale: LC_TIME: cannot change的處理方法Linux