Why is the:: operator used in C++ instead of the. operator for this purpose?
There is no distinct operator in Java, and it works great.
Is there a distinction between C++ and Java that necessitates the use of a separate operator in order for C++ to be parsable?
My only idea is that:: is required for precedence reasons, but I'm not sure why it should take precedence over, say,...
The only way I can see it happening is if something like
a.b::c;
would be parsed as
a.(b::c);
, but I can't think of a situation where this syntax would be lawful in any case.
Maybe "they do different things, so they might as well look different" is the case.
That, however, does not explain why : : has higher priority than.