I’m an starter at c++, and I’m trying to develop a simple OpenGL application. Looking at some code on the internet I found this:
::glutDisplayFunc(myPixmap::drawCallback);
Ignore the function itself, i just wanted to know what that line of code does. Does it call the function? I know it’s probably a silly question, but I can’t find the answer
::is the scope resolution operator.If a container (namespace or class) name appears before it, it causes the compiler to only look inside that container for the specified identifier. This is the way to refer to static members of a class from outside the class.
If it appears first, without a name in front, it means to look in the global namespace.
Your example code appears to be contain both usages. That line of code calls
::glutDisplayFunc. But the other function,myPixmap::drawCallback, isn’t called. It’s address is saved for later.