Scope operator

What is the meaning of the scope operator before LoadBitmap in the code below...

m_button.SetBitmap(::LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_GREEN)));

m_button is a CButton object assigned to an MFC dialog button. The goal here is to put the IDB_GREEN bitmap onto the button, and this code does do that, but the :: is not clear.  I understand that normally you would use ::  if you wanted to specify the class, on the left side,   that the method, on the right side,  is to come from, but the left side of this :: is not a class, it's a method of the CButton class. Curiously, the code works fine without the :: and I only put it in because the sample code I got this from had it.

Thanks for any thoughts,
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

>>the :: is not clear

::LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_GREEN))

instucts the compiler to explicitly choose the Win32 API 'LoadBitmap()' instead of 'CBitmap::LoadBitmap()', that's why the scope operator is being used - to avoid a potential naming conflict with that method.
stevaAuthor Commented:
Ok, but how does ::LoadBitmap instruct the compiler to use the Win32 version?  From everything I've read, :: separates a class on the left from a method on the right.  What is the meaning, in general, when there's no class on the left?
in general :: instructs compiler get method from GLOBAL namespace.
:: is a scope resolution operator. Often it is used to select the class scope. A different example is the use of cout. If you don't include the line
using namespace std;
you need to specify the namespace of cout for using it:
std::cout << "test" << std::endl;

if no namespace is given infront of this operator the global namespace is used. So ::LoadBitmap used the function from the global namespace whereas LoadBitmap inside a class function will take the corresponding member function of that class (or of any base it is derived when it is accessible).

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.