2015-04-12 115 views
0

我明白const關鍵字意味着你不能改變一個變量的值,這是什麼意思,如果它使用的是這樣的:const關鍵字使用C++

const char* const& message

+0

這是對常量字符的const指針的引用 – sp2danny

+0

也許[this](http://stackoverflow.com/questions/1143262/what-is-the-difference-between-const-int-const-int -const-和-INT const的?RQ = 1)?或[這](http://stackoverflow.com/questions/89056/how-do-you-read-c-declarations?lq=1)? – chris

回答

2

第一個常量停留指針引用本身不能改變,所以你不能這樣做:

message = &something; 

第二常量是指針的內容,所以你不能這樣做:

*message = something; 
+0

ups。對不起..我會修復它 –

+0

修復它..現在? –