More on the const Keyword
This section is very important. It reviews the multiple meanings of the keyword const and shows how to use this keyword for one of the most important tasks of the software developer—transmitting the developer's knowledge about properties of program components to the maintenance programmer. Failure to do so is one of the simplest (and most common) ways to contribute to software crisis.
As you saw earlier (Chapters 4, "C++ Control Flow," and 7), the const keyword has several meanings in C++; the meaning depends on the context. When the keyword precedes the type name of the variable, it specifies that the value of the variable will remain constant. The variable has to be initialized at definition, and any attempt to assign ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access