Quantcast
Channel: User Peter - Reinstate Monica - Stack Overflow
Viewing all articles
Browse latest Browse all 239

Answer by Peter - Reinstate Monica for Why does C++ introduce a "::" instead of using a "."?

$
0
0

I hope this question will be closed soon (not because it is bad but because it has been asked and answered over at softwareenineering (where it doesn't belong either, by the way: It should be in programming language design and implementation).

While it stands though I'll give the main points in Manlio's good answer there:

  • The original C with classes used indeed a dot.
  • Stroustrup decided to switch to a double colon to avoid "minor confusion" among users and to avoid ambiguity demonstrated by constructed examples.

The latter point seems remote given that other languages do just fine with just the dot; but one place where ambiguity between types and other names comes into play are C++ templates where we already must prefix dependent names with typename.


Viewing all articles
Browse latest Browse all 239

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>