Sign in to follow this  

::MessageBox

This topic is 4197 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

The :: tells the compiler to use the MessageBox function at the global scope - i.e. not within any classes or namespaces. This is useful if you are, for example, using a class that contains a function called MessageBox but you want to call the Win32 function by the same name.

Share this post


Link to post
Share on other sites
"::" without left operand make it use global namespace's MessageBox function.
The left operand indicate the object(class), the right operand indicate member function/variable.

Example:

class example {
public:
static int Hello;
static MessageBox(){};
};

void main {
example::Hello = 15; // This will set "example" class's static variable "Hello" to 15
example::MessageBox(); // This will call "example" class's static function "MessageBox"
}

Share this post


Link to post
Share on other sites

This topic is 4197 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this