Mastering C++: 2025 All-In-One Quiz – Ace 'Thinking in C++' with Comprehensive Practice!

Image Description

Question: 1 / 565

In C++, casting away constness of a variable is achieved using which keyword?

static_cast

reinterpret_cast

const_cast

C++ provides four types of casting - static_cast, reinterpret_cast, const_cast, and dynamic_cast. In this case, the keyword used to cast away constness of a variable is const_cast. Option A, static_cast, performs a general type conversion, option B, reinterpret_cast, converts any pointer into any other pointer type, and option D, dynamic_cast, is used for casting within a class hierarchy. Since none of these options specifically target constness, they are not the correct answer for this question.

Get further explanation with Examzify DeepDiveBeta

dynamic_cast

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy