开发者

Why is the C++ scope resolution operator ::?

This is one of the few questions I didn't find an answer to in Design and Evolution of C++ by Stroustroup. Why is the C++ scope resolution operator ::, as opposed to just :?

I'm guessing it's becaus开发者_运维百科e : is already used to indicate the start of an initialization list in a constructor. Does anyone else agree, disagree, or have a definitive answer on this?


It would create an ambiguity with goto labels, for one.

foo:bar;  // is foo a label or a namespace?
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜