Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 2
    I don’t think OP tries to modify a const object, but just wonders if it could be misleading to mark a method const if it modifies other non-const objects (so not *this) Commented Sep 27, 2022 at 6:38
  • Christoph, to see whether it is misleading you first need to know what "const" for a method actually means. Commented Sep 27, 2022 at 11:44
  • In fact, fromnthe popular programming languages I know, only C++ offers the const member functions. There is no equivalent in Java, C#, objective C and swift (except that swift methods on struct are by default const unless declared as mutable). and in c++ its purpose is well defined. Commented Sep 27, 2022 at 18:49