Multiple choice

Which of the following is NOT a use of the scope resolution operator (::) in C++?

  1. It used for defining class methods, outside the class.

  2. It is used to inherit a base class to declare a derived class.

  3. It is used to help the compiler differentiate between a local and a global variable.

  4. It used to call overridden member of the base class from the derived class.

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The scope resolution operator is not used to inherit a class. The syntax for inheritance has a colon (:), not a scope operator. For example, to inherit a class named 'B' from a class named 'A', the syntax will be class B : public A