const_cast Operator

Most of them noticed the peculiarity of  “const_cast”. The const_cast operator can be used to remove the const, volatile, and __unaligned attribute(s) from a class.

You cannot use const_cast for any other types of casts, such as casting a base class pointer to a derived class pointer. If you do so, the compiler will report an error.

Keep smiling.. 🙂

Advertisements