title: Why does C++ need the scope resolution operator?
body: <p>(I know what the scope resolution operator does, and how and when to use it.)</p>
  
  <p>Why does C++ have the <code>::</code> operator, instead of using the <code>.</code> operator for this purpose? Java doesn't have a separate operator, and works fine. Is there some difference between C++ and Java that means C++ requires a separate operator in order to be parsable?</p>
  
  <p>My only guess is that <code>::</code> is needed for precedence reasons, but I can't think why it needs to have higher precedence than, say, <code>.</code>. The only situation I can think it would is so that something like</p>
  
  <pre><code>a.b::c;
  </code></pre>
  
  <p>would be parsed as</p>
  
  <pre><code>a.(b::c);
  </code></pre>
  
  <p>, but I can't think of any situation in which syntax like this would be legal anyway.</p>
  
  <p>Maybe it's just a case of "they do different things, so they might as well look different".  But that doesn't explain why <code>::</code> has higher precedence than <code>.</code>.</p>