Mxx
Mxx

Reputation: 11

What does :: at function name mean?

I saw code like:

using namespace zzzz;

void XX::YY()
{

}

how does :: work if you write like that?

Upvotes: 1

Views: 639

Answers (1)

Ben Zotto
Ben Zotto

Reputation: 71008

It's not Java, it's C++. (The using namespace and the :: is the giveaway).

The :: is the "scope operator". It's how in C++ you say that YY is a member of the class XX. Java doesn't need this because methods are always defined within the class they belong to; in C++ you can define them in another file.

Upvotes: 7

Related Questions