It's a good practice to put const behind the variable it applies to. In you case, if myClass is a simple class or basic datatype there is no difference. However, if myClass is a datetype defined as a pointer, or, a template which could potentially become a pointer, you will encounter unexpected errors.
【在 t*****g 的大作中提到】 : It's a good practice to put const behind the variable it applies to. : In you case, if myClass is a simple class or basic datatype there is no : difference. However, if myClass is a datetype defined as a pointer, or, a : template which could potentially become a pointer, you will encounter : unexpected errors.
呵呵,刚好google book可以翻翻前言 你说的那一段看见了, 作者的确证实了 const T === T const, unless T is a macro (textual replacement) which is what I said. of course, if you textual replace T with char*, then const char * != char * const, but that's not what I said
Yea, I was wrong on that. T = char * doesn't make const T = const char *, it 's more like const (char *) where char * has higher priority.
【在 t****t 的大作中提到】 : 呵呵,刚好google book可以翻翻前言 : 你说的那一段看见了, 作者的确证实了 : const T === T const, unless T is a macro (textual replacement) : which is what I said. : of course, if you textual replace T with char*, then : const char * != char * const, but that's not what I said