开发者

What does :: at function name mean?

开发者 https://www.devze.com 2023-01-14 20:45 出处:网络
I saw code like: using namespace zzzz; void XX::YY() { } how 开发者_如何学Godoes :: work if you write like that?It\'s not Java, it\'s C++. (The using namespace and the :: is the giveaway).

I saw code like:

using namespace zzzz;

void XX::YY()
{

}

how 开发者_如何学Godoes :: work if you write like that?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消