为什么::?为什么不 : ?为什么不 。 ? < - 不那么混乱?!? [英] Why :: ? Why not : ? Why not . ? <- less clutter ?!?

查看:65
本文介绍了为什么::?为什么不 : ?为什么不 。 ? < - 不那么混乱?!?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


为什么C ++使用:: for members / methods为什么不只是:?


例如:


long Test :: TimesOne()const {return mVal; }


替代方案:


long测试:TimesOne()const {return mVal; }


为什么要使用:根本?为什么不坚持。 ?


long Test.TimesOne()const {return mVal; }


^^^较少杂乱^^^


再见,

Skybuck。

Hello,

Why does C++ use :: for members/methods why not just : ?

For example:

long Test::TimesOne() const { return mVal; }

Alternative:

long Test:TimesOne() const { return mVal; }

Why use : at all ? Why not stick to . ?

long Test.TimesOne() const { return mVal; }

^^^ Less clutter ^^^

Bye,
Skybuck.

推荐答案

Skybuck Flying写道:
Skybuck Flying wrote:

为什么C ++使用:: for members / methods为什么不: ?


例如:


long Test :: TimesOne()const {return mVal; }


替代方案:


long测试:TimesOne()const {return mVal; }


为什么要使用:根本?为什么不坚持。 ?


long Test.TimesOne()const {return mVal; }


^^^减少杂乱^^^
Why does C++ use :: for members/methods why not just : ?

For example:

long Test::TimesOne() const { return mVal; }

Alternative:

long Test:TimesOne() const { return mVal; }

Why use : at all ? Why not stick to . ?

long Test.TimesOne() const { return mVal; }

^^^ Less clutter ^^^



减少杂乱并不意味着更清晰。编程不是

摄影。


打个比方:我相信如果你把所有的路标都弄圆了,

他们会更多难以阅读而不是他们现在的,

几种不同的形状。


我失去了这篇关于
$ b复杂性的精彩文章的链接$ b英语和减少它的建议。它开始了,因为我记得

的提议用'k'和's'代替'c''以反映

它的声音。然后它继续建议用单个元音代替一些双元音,或用''z'代替''th',所以

。 Hillarious!谁知道在哪里找到它?..


我用Google搜索,我找到了一个。请查看:
http://www.polishnews。 com / text / humor ... n_english.html


V

-

请删除资金' 'A'在通过电子邮件回复时

我没有回复最热门的回复,请不要问

Less clutter does not mean more clarity. Programming is not
photography.

Analogy: I believe that if you make all road signs round,
they will be more difficult to read than with their current,
several distinct shapes.

I lost the link to this wonderful essay on the complexity of
English and proposals to reduce it. It starts, as I recall
with the proposal to replace ''c'' with ''k'' and ''s'' to reflect
the sounds it makes. Then it goes on to propose replacing
some diphthongs with single vowels or ''th'' with ''z'', and so
forth. Hillarious! Anyone knows where to find it?..

I googled for it, and I found one. Check it out:
http://www.polishnews.com/text/humor...n_english.html

V
--
Please remove capital ''A''s when replying by e-mail
I do not respond to top-posted replies, please don''t ask


制作圆形或方形或三角形的路标不会增加或减少

杂乱。


不必要的::()使得它更难以理解,写

并阅读它。


一个好的测试将是:


问一个人是不是一个人喜欢:


长测试:: TimesOne()





长Test.TimesOne


C ++混乱的另一个例子是运算符重载< - 可怕的混乱。


只需记住编译所需的混乱需要一个n

大象的记忆。


再见,

Skybuck。
Making road signs round or square or triangular does not add or reduce
clutter.

The unnecessary :: () makes it definetly more harder to understand, write
and read it.

A good test would be:

Ask someone who is dislexies which one he prefers:

long Test::TimesOne()

or

long Test.TimesOne

Another example of C++ clutter is operator overloading <- horrible clutter.

Just remembering what clutter is needed to make it compile requires an
elephant''s memory.

Bye,
Skybuck.

* Skybuck Flying:
* Skybuck Flying:

你好,


为什么C ++使用:: for members / methods为什么不只需:?


例如:


long Test :: TimesOne()const {return mVal; }


替代方案:


long测试:TimesOne()const {return mVal; }


为什么要使用:根本?为什么不坚持。 ?


long Test.TimesOne()const {return mVal; }


^^^较少混乱^^^
Hello,

Why does C++ use :: for members/methods why not just : ?

For example:

long Test::TimesOne() const { return mVal; }

Alternative:

long Test:TimesOne() const { return mVal; }

Why use : at all ? Why not stick to . ?

long Test.TimesOne() const { return mVal; }

^^^ Less clutter ^^^



这个选择可能包含在Bjarne Stroustrup''中。设计和

Evolution" -book。


但缺点是

This choice is probably covered in Bjarne Stroustrup''s "Design and
Evolution"-book.

But the short of it is that


这篇关于为什么::?为什么不 : ?为什么不 。 ? &lt; - 不那么混乱?!?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆