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.
精彩评论