'What is the meaning of multiple class methods separated by "::"? [duplicate]
I found this line of code where I'm working, but I don't quite understand its meaning:
virtual method1::method2::method3 f() = 0;
In the main function, I have method1::method2::method3.g1().g2(). I really don't understand. I know method::A where A is a class.
Solution 1:[1]
:: is a scope operator.
You may need to append multiple of them either when using nested classes (a class defined within another class) or when you use namespaces. Resolution is done the same way.
Solution 2:[2]
:: is the scope resolution operator. It allows you to statically traverse scopes such as namespaces and classes in order to reference the identifier you want.
I think what you have is not methods but namespaces and classes.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Obsidian |
| Solution 2 |
