方法和成员函数之间的区别 [英] Distinction between a method and a member function

查看:248
本文介绍了方法和成员函数之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我在C ++ Gotchas中看到了一个细节。作者:Stephen Dewhurst让我很困惑

。作者说:


''C ++没有方法。 Java和Smalltalk有方法。当你谈到

一个面向对象的设计并且感觉特别自命不凡时,你可以使用术语消息来表示。和方法,但是当你开始讨论你的设计的b ++ b ++实现时,请使用术语函数调用。和

会员功能。''


他没有说的是方法与会员之间的区别

功能是。


此外,我查看了C ++常见问题解答和该组的存档,

并且都没有提及区别。这个组中有不少帖子

似乎可以互换使用这些术语。


有人能简单解释一下这有什么区别吗?


Tim

Hi,

I came across a detail in "C++ Gotchas" by Stephen Dewhurst that confused me
a bit. The author states:

''C++ has no "methods." Java and Smalltalk have methods. When you talk about
an object-oriented design and are feeling particularly pretentious, you may
use the terms "message" and "method," but when you get down to discussing a
C++ implementation of your design, use the terms "function call" and
"member function."''

What he doesn''t say is what the difference between a method and a member
function is.

Furthermore, I''ve looked through the C++ FAQ and the archive of this group,
and neither mention the distinction. Quite a few posts in this group do
seem to use the terms interchangably.

Can anyone explain briefly what the difference is?

Tim

推荐答案

On Sun,2003年8月31日11:56:24 +0000(UTC),Tim Martin< ta ***@cam.ac.uk>写道:
On Sun, 31 Aug 2003 11:56:24 +0000 (UTC), Tim Martin <ta***@cam.ac.uk> wrote:


我在C ++ Gotchas中看到了一个细节。作者:Stephen Dewhurst让我有点困惑。作者指出:

''C ++没有方法。 Java和Smalltalk有方法。当你谈到面向对象的设计并且感觉特别自命不凡时,你可以使用术语消息。和方法,但是,当您开始讨论设计的C ++实现时,请使用术语函数调用。和
成员函数。''

他没有说的是方法和成员之间的区别是什么。

此外,我已经查看了C ++ FAQ和该组的档案,
并没有提到这种区别。这个小组中有不少帖子似乎可以互换使用这些术语。

任何人都能简单解释一下这有什么区别吗?
Hi,

I came across a detail in "C++ Gotchas" by Stephen Dewhurst that confused me
a bit. The author states:

''C++ has no "methods." Java and Smalltalk have methods. When you talk about
an object-oriented design and are feeling particularly pretentious, you may
use the terms "message" and "method," but when you get down to discussing a
C++ implementation of your design, use the terms "function call" and
"member function."''

What he doesn''t say is what the difference between a method and a member
function is.

Furthermore, I''ve looked through the C++ FAQ and the archive of this group,
and neither mention the distinction. Quite a few posts in this group do
seem to use the terms interchangably.

Can anyone explain briefly what the difference is?




没有。但是,在C ++中,术语是成员函数。在Java中,

术语是方法。不同的语言,不同的术语。


C ++标准使用术语成员函数,并坚持使用域中使用的

约定来协助通信。


-

Sam Holden



There isn''t any. However, in C++ the term is member function. In Java the
term is method. Different language, different lingo.

The C++ standard uses the term member function, and sticking with the
convention used in a domain assists communication.

--
Sam Holden


Tim Martin写道:
Tim Martin writes:
我在C ++ Gotchas中看到了一个细节。斯蒂芬·德赫斯特(Stephen Dewhurst)让我感到困惑。作者指出:

''C ++没有方法。 Java和Smalltalk有方法。当你谈论面向对象设计的
并且感觉特别自命不凡时,你b $ b可能会使用术语消息。和方法,但是当你开始讨论你的设计的C ++实现
时,请使用术语函数调用。和
成员函数。''

他没有说的是方法和成员之间的区别是什么。

此外,我查看了这个
组的C ++ FAQ和存档,但都没有提到这个区别。这个小组中有不少帖子似乎可以互换使用这些术语。

任何人都能简单解释一下这有什么区别吗?
I came across a detail in "C++ Gotchas" by Stephen Dewhurst that confused me a bit. The author states:

''C++ has no "methods." Java and Smalltalk have methods. When you talk about an object-oriented design and are feeling particularly pretentious, you may use the terms "message" and "method," but when you get down to discussing a C++ implementation of your design, use the terms "function call" and
"member function."''

What he doesn''t say is what the difference between a method and a member
function is.

Furthermore, I''ve looked through the C++ FAQ and the archive of this group, and neither mention the distinction. Quite a few posts in this group do
seem to use the terms interchangably.

Can anyone explain briefly what the difference is?




就我而言,方法是Smalltalk行话和成员函数

是C ++术语。

alt.comp.lang.learn.c-c ++上有一个最近的43消息主题,大部分都没有意义。在搜索它时,我注意到几年前的125消息线程

。我怀疑这是茶壶中的暴风雨。

我正在使用一个名为Lookout Express的原始微软程序,所以这个链接

可能会搞砸了。

http://www.google.com/groups?hl=zh-CN&l...=bi38c9%249dg%

241%40titan.btinternet.com& rnum = 1& prev = / groups%3Fq%3Dmember%2Bsmalltalk%2Bgr

oup:alt.comp.lang.learn.cc%252B%252B%26num%3D20%26hl%3Den%26lr%3Dlang_en% 26

即%3DUTF-8%26sa%3DG%26scoring%3Dd



As far as I am concerned "method" is Smalltalk jargon and "member function"
is C++ jargon. There is a recent,43 message thread, mostly pointless, on
alt.comp.lang.learn.c-c++. In searching for it I noted a 125 message thread
from a couple years ago. I suspect this was the same tempest in a teapot.
I am using a primitive Microsoft program called Lookout Express so this link
will probably be messed up.

http://www.google.com/groups?hl=en&l...=bi38c9%249dg%
241%40titan.btinternet.com&rnum=1&prev=/groups%3Fq%3Dmember%2Bsmalltalk%2Bgr
oup:alt.comp.lang.learn.c-c%252B%252B%26num%3D20%26hl%3Den%26lr%3Dlang_en%26
ie%3DUTF-8%26sa%3DG%26scoring%3Dd


" Tim Martin" < TA *** @ cam.ac.uk>在消息中写道

新闻:bi ********** @ hercules.btinternet.com ...
"Tim Martin" <ta***@cam.ac.uk> wrote in message
news:bi**********@hercules.btinternet.com...

我在C ++ Gotchas中看到了一个细节。斯蒂芬·德赫斯特(Stephen Dewhurst)让我感到困惑。作者指出:

''C ++没有方法。 Java和Smalltalk有方法。当你谈论面向对象设计的
并且感觉特别自命不凡时,你b $ b可能会使用术语消息。和方法,但是当你开始讨论你的设计的C ++实现
时,请使用术语函数调用。和
成员函数。''

他没有说的是方法和成员之间的区别是什么。

此外,我查看了这个
组的C ++ FAQ和存档,但都没有提到这个区别。这个小组中有不少帖子似乎可以互换使用这些术语。

任何人都能简单解释一下有什么区别吗?

Tim
Hi,

I came across a detail in "C++ Gotchas" by Stephen Dewhurst that confused me a bit. The author states:

''C++ has no "methods." Java and Smalltalk have methods. When you talk about an object-oriented design and are feeling particularly pretentious, you may use the terms "message" and "method," but when you get down to discussing a C++ implementation of your design, use the terms "function call" and
"member function."''

What he doesn''t say is what the difference between a method and a member
function is.

Furthermore, I''ve looked through the C++ FAQ and the archive of this group, and neither mention the distinction. Quite a few posts in this group do
seem to use the terms interchangably.

Can anyone explain briefly what the difference is?

Tim




作者似乎对一些不存在
的细节很迂腐。在谈论C ++时经常使用成员函数,但在实际中它们都是可互换的描述*,并传达了对某个对象的某些操作的概念。这基本上是一个术语问题。


*除非或许,你在谈论每个

语言的一般主题的体现之间的差异;在这种情况下,可能一致地使用不同的术语是有用的




The author appears to be pedantic about some detail that does not really
exist. Member functions are often used when talking about C++, but in
reality they are all interchangeable descriptions*, and convey the notion of
some action on an object. It is, basically a question of terminology.

* Unless perhaps, you are talking about the differences between each
languages'' embodiment of the general theme; In that case maybe it''s useful
to use different terminology consistently.


这篇关于方法和成员函数之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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