I am learning C++ .net programming and was wondering why the code for creating a messagebox is

MessageBox.Show("Hello, World!");

in C# and

MessageBox::Show("Hello, World!");

in C++. Why is the dot substituted with a double colon in the C++ code?

My source: http://msdn.microsoft.com/nb-no/library/z9w2f38k

Recommended Answers

All 2 Replies

In C#, static members/methods are referenced with a dot and in C++, they are referenced with a ::
That is called a Scope Resolution Operator

...but those are just syntax differences between the two languages.

Later, you will notice things allocated with gcnew will be decorated a caret ^.

All of this is to allow C++/CLI to operate with (not interfere with) standard C++.

I See ... Thanks :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.