About 19,000 results
Open links in new tab
  1. If a function should be able to be called on a const object, it should be designated as const.

  2. The “const” suffix for a read-only method like getMonth can only appear inside a method declared as a member of a class. It means “read only property” of the object the class defines.

  3. Use const references or call-by-value for input values Particularly for large (# bytes) values, use references (no copying)

  4. Although the const qualifier appears in p’s declaration, it applies only to what p points to, not to p itself. If p were declared as “constpointer to ...” then p would have a const-qualified type.

  5. References allow a function to change the value of the argument, which is sometimes useful. Otherwise, const references can be used to guarantee the function won't change the argument. Because a copy …

  6. When you put "const" in front of a parameter, it means that it cannot be modified in the function. (In other words, you'll get a compile-time error if you try to assign to it.)

  7. Once an object is declared const, no part (actually, no bit) of it can be changed after construction (and initialization) However, while programming we often need an object to be logically constant.