Skip to content
CodeWiki
Practice
Paths
Tracks
Cheatsheets
Playground
Glossary
AI era
Search
⌘K
English
English
Chinese
Practice
Paths
Tracks
Cheatsheets
Playground
Glossary
AI era
English
English
Chinese
Practice
/
Quiz
/
C++
/
Classes
Why should a member function that only reads object state usually have a trailing const?
from Classes
C++23
beginner
1 min
Why should a member function that only reads object state usually have a trailing const?
It can be called through const objects and prevents ordinary mutation through this.
It makes every returned reference safe after the object is destroyed.
It guarantees the function is thread-safe.
It forces the compiler to evaluate the function at compile time.
Check
Ask AI about this kata
Report an error
previous kata
What language-level difference applies to otherwise identical class and struct definition…
Quiz
next kata
What does this program print?
Predict the output
A new version is available
Reload