const Functions
Let’s learn about const functions and their characteristics.
Introduction
Should we declare a member function as const
whenever possible?
Yes, we should! It clarifies design intent, improves readability, and allows the compiler to catch more errors. We might even benefit from some optimizations sometimes.
Get hands-on with 1200+ tech skills courses.