Multiple choice

Which one of the following is a scope resolution operator?

  1. ->

  2. :

  3. &&

  4. ::

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

The scope resolution operator (::) in C++ is used to access global variables when local variables have the same name, to define class methods outside the class definition, and to access static class members. The arrow operator (->) is for pointer member access, && is logical AND, and : is used in ternary operators.