What are the semantics of a const member function?

后端 未结 9 784
囚心锁ツ
囚心锁ツ 2020-12-06 16:51

I understand that the function is not allowed to change the state of the object, but I thought I read somewhere that the compiler was allowed to assume that if the function

9条回答
  •  情书的邮戳
    2020-12-06 17:44

    I doubt it, the function could still call a global function that altered the state of the world and not violate const.

提交回复
热议问题