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 ...
Get Core C++ A Software Engineering Approach now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.