We now consider additional C++ features. First, we discuss the const_cast
operator, which allows you to add or remove the const
qualification of a variable. Next, we discuss namespace
s, which can be used to ensure that every identifier in a program has a unique name and can help resolve naming conflicts caused by using libraries that have the same variable, function or class names. We then present several operator keywords that are useful for programmers who have keyboards that do not support certain characters used in operator symbols, such as !
, &
, ^
, ~
and |
. We continue our discussion with the mutable
storage-class specifier, which enables you to indicate that a data member should always be modifiable, even when it appears in an object that’s currently being treated as a const
object by the program. Next we introduce two special operators that you can use with pointers to class members to access a data member or member function without knowing its name in advance. Finally, we introduce multiple inheritance, which enables a derived class to inherit the members of several base classes. As part of this introduction, we discuss potential problems with multiple inheritance and how virtual inheritance can be used to solve them.