const in C++

Published: Updated:
Published: Updated:

Can I just show four slides. They are totally self-exlanatory

const before type

The structure itself is const, cannot change its integrity, but can assign new value to the variable

cpp const variable 1

const after type

Cannot assign new value. This is handy for declaring the value returned from a function.

cpp const variable 2

Cannot assign new value, but can change the internals

cpp const variable 3

const before and after type

Const variable with constant data

cpp const variable 4

As usual all code for your experiments and slides are in cpp-skill repository.

Similar posts

Rate this page