Working of Scope Resolution Operator( : : )?

4/11/2019 4:02:45 PM


7 Answers

New Answer


Any varible has its own scope. for example... int x = 3; //global scope int numberX () { int x = 10; return x; } //scope of this function class NummerX { private: int x = 666; //scope of the class public: getX() { return x} } .... In the main() , you could call all 'x' variable unumbigously beacause each 'x' is applied in a scope. the operator :: changes the scope in question... Have you got? scope means +-: for each 'x' the compiler pick up the more suitible according to the context


I didn't get your question. Can you clarify it more. For now I got this for you https://www.tutorialspoint.com/Scope-resolution-operator-in-Cplusplus


You can use this for get variable in static class, make "body" of method, etc., e.g.: class A { void method(); }; void A::method() { cout << "method();"; }


Why don't(can't) we learn print f in this app?


printf() is in C. C++ use cout . Printf wold be compiled by C++ compiler, but avoid this as you can.



I am new here