As known scope resolution operator used for the purposes of qualified name lookup. But what is the value returned by ::
? As I understood it is postfix unary operator. Consider the following:
namespace A
{
//something
}
A:: //error: expected unqualified-id before ‘int’
int main(){ }
Can you explain that behavior?
The scope resolution operator
::
is only a syntatic operator, has no other semantics. That is, there are operators that only contribute to the syntax of the language, and others that contribute to the semantics/runtime behaviour of the program too, and that semantics could be customized. Thats operators overloading.