C++ How to Program (10th Edition)
C++ How to Program (10th Edition)
10th Edition
ISBN: 9780134448237
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
Question
Book Icon
Chapter 9, Problem 9.3E
Program Plan Intro

Scope Resolution Operator:

In C++, the double colon “::” is called scope resolution operator. The purpose of the scope resolution operator is:

Expert Solution & Answer
Check Mark

Explanation of Solution

Explanation:

  • If, in a program, there is a local variable with the same name as global variable, then while compiling, the complier uses the local variable. In order to access the global variable, user must prefix the variable name with “:: variable name”.
  • To define a function outside a class.
  • If user wants to access static variables of a class.
  • If, in two classes, there are same variable names, then, to distinguish, scope resolution operator is used. That means, for multiple inheritance, scope resolution operator is used.

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
What are the benefits of using a function?
How does the use of a function help?
When calling a function with several arguments, parameter order matters.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning