answersLogoWhite

0

Scope resolution allows the programmer to disambiguate between names that are common to two or more namespaces. For instance, if you imported two namespaces that both exposed different string classes, the compiler would not know which string class to use unless you use scope resolution to differentiate them. Scope resolution can also be used to differentiate between the different function overrides within a class hierarchy. By default, the most-derived function override is always executed implicitly, but that override may choose to invoke one or more of its base class overrides using scope resolution.

struct a { virtual void foo() {/*...*/} };

struct b : a { virtual void foo() override; };

void b::foo()

{

a::foo(); // explicitly invoke base class method using scope resolution.

// ...specialisation code goes here...

}

User Avatar

Wiki User

10y ago

What else can I help you with?

Related Questions

Can the scope resolution operator be overloaded in C plus plus?

No.


Why scope resolution is required in c?

Scope resolution is not required in C because C does not support namespaces. All non-local names are declared in the global scope.


Use of scope resolution operator in C programming?

:: operator can not be used in C.


What are special operators in c plus plus?

The only "special" operators in C++ are those that cannot be overloaded. That is; the dot member operator (.), pointer to member operator (.*), ternary conditional operator (:?), scope resolution operator (::), sizeof() and typeof().


Which c plus plus operators cannot be overloaded?

1. Member-of operator (.) 2. Pointer-to-member-of operator (.*) 3. Ternary condition operator (?:) 4. Scope resolution operator (::) 5. sizeof operator 6. typeid operator


Which operator is allow to access hidden global variable in c plus plus?

A hidden global variable must be one that has its scope blocked by a local variable of the same name. To access the hidden variable, use the scope resolution operator ::, such as is ::variable_name. If there is another reason for the hidden status, please clarify and restate the question.


How do you use the scope resolution operator in c?

You use the scope resolution operator (::) whenever there is ambiguity as to which function or member you are referring to. For instance, if two functions in two separate namespaces have the same signature, you must use scope resolution to call the correct version of the function. Similarly, when calling a base class method from a derived overridden method, you must use scope resolution to ensure the base class method is called from the override.


What is the syntax of c plus plus?

The answer is really beyond the scope of this site. You would probably need to buy a textbook.


What is the operator that cannot be overloaded in c plus plus and java?

conditional operator , size of operator , membership operator and scope resulation operator can not be overload in c++


What brings a story to it close?

C. resolution


What command is used to destroy object in c plus plus?

You use delete object in C++ to delete an object. You can also implicitly delete the object, if it is automatic type, by going out of local scope.


What are the disadvantages of scope resolution operator?

it cannot be operator overloaded.