The concept of constant appears in many programming languages. Most programmers are familiar with constant data; for example, a math library could include a symbolic constant for PI while a unit-conversion library might provide constants for the conversion factors.
The advantages of using constants are well known: It is easier to reason about the behavior of a block of code if you are sure some values will not change.
The C++ language uses the keyword const to indicate a constant. C++ has an extremely rich notion of constant that extends far beyond the simple case of symbolic constant. In C++, many things can be marked const:
In this task, you will explore several of the most important uses of constants in C++. You will experiment with constant objects, constant pointers and references, implement bitwise and semantic const, and code a class that is const-correct.
GK Digital is an online, collaborative learning platform built from the ground up to be a superior learning experience on the web. It is self-paced and yet supported by both your peers and instructors. We have reimagined what learning should be in a world full of public information such as blogs, YouTube, etc. GK Digital is professional training in the 21st century.