What is scope resolution in c ++? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is scope resolution in c ++?

Can we have scope resolution in c?

13th Jul 2016, 6:00 PM
Pradip Gangoda
Pradip Gangoda - avatar
4 Answers
+ 8
Scope resolution( : : ) is special type if operator by which we can use global variable over local variable or it can be used to access public class member function outside the class. i.e. #include<iostream> int a = 10; int main(){ int a = 20; cout << "local a- " << a; cout << "global a- " << ::a; }
13th Jul 2016, 6:51 PM
Sagar Panchal
Sagar Panchal - avatar
+ 1
yes the "::" is an operator and is present in most of languages like C, C++, Java, etc.... and it has very simple meaning the variable after "::" has its scope defined in the upper compound block or it can be used to access the functions of a class(not objects) since you cannot directly access the functions because they are just like blueprints...I.e., non existent ask if you aren't satisfied
13th Jul 2016, 8:02 PM
Vedant Patadia
Vedant Patadia - avatar
+ 1
" -> " is used to point objects
28th Jul 2016, 4:46 PM
Ganesh SM
Ganesh SM - avatar
0
Speakink of operators in oop, what's the meaning of -> operator?
25th Jul 2016, 2:21 AM
Cristi
Cristi - avatar