Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Distinction between a method and a member function

Reply
Thread Tools

Distinction between a method and a member function

 
 
Tim Martin
Guest
Posts: n/a
 
      08-31-2003
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


 
Reply With Quote
 
 
 
 
Sam Holden
Guest
Posts: n/a
 
      08-31-2003
On Sun, 31 Aug 2003 11:56:24 +0000 (UTC), Tim Martin <(E-Mail Removed)> wrote:
> 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?


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

 
Reply With Quote
 
 
 
 
Jason
Guest
Posts: n/a
 
      08-31-2003
"Tim Martin" <(E-Mail Removed)> wrote in message
news:bisnp7$a4k$(E-Mail Removed)...
> 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
>


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.


 
Reply With Quote
 
osmium
Guest
Posts: n/a
 
      08-31-2003
Tim Martin writes:

> 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?


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


 
Reply With Quote
 
Kevin Goodsell
Guest
Posts: n/a
 
      08-31-2003
osmium wrote:
>
> 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
>


You can shorten those Google links a lot:

http://www.google.com/groups?threadm...btinternet.com

That should do it. Only the "threadm" part is important, or "selm" if
it's a particular post, rather than a complete thread.

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.

 
Reply With Quote
 
E. Robert Tisdale
Guest
Posts: n/a
 
      09-01-2003
Tim Martin wrote:

> 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 interchangeably.
> Can anyone explain briefly what the difference is?


The term *method* is usually reserved for the abstract description.
When the abstract method is implemented,
it is called a procedure, subroutine, function, operator or macro
as is appropriate for the computer programming language in question.
The reference to methods in the context of the Java or Smalltalk
computer programming languages is probably abusive.

 
Reply With Quote
 
llewelly
Guest
Posts: n/a
 
      09-01-2003
Tim Martin <(E-Mail Removed)> writes:

> 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?


Sometimes the term 'method' is used to indicate any operation on an
object. In C++ many operation should not be member functions,
e.g. operators like +, *, ==, and so on.
 
Reply With Quote
 
E. Robert Tisdale
Guest
Posts: n/a
 
      09-01-2003
llewelly wrote:

> In C++ many operation should not be member functions,
> e.g. operators like +, *, ==, and so on.


Nonsense!

 
Reply With Quote
 
Gary Labowitz
Guest
Posts: n/a
 
      09-01-2003
"E. Robert Tisdale" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Tim Martin wrote:
>
> > Can anyone explain briefly what the difference is?

>
> The term *method* is usually reserved for the abstract description.
> When the abstract method is implemented,
> it is called a procedure, subroutine, function, operator or macro
> as is appropriate for the computer programming language in question.
> The reference to methods in the context of the Java or Smalltalk
> computer programming languages is probably abusive.


Nah. What is refered to as a member function in C++ IS a method in Java.
Just a different name.
A simple function is not a member of a class. There is no equivalent in
Java.
It's just different names.
--
Gary


 
Reply With Quote
 
jeffc
Guest
Posts: n/a
 
      09-02-2003

"Tim Martin" <(E-Mail Removed)> wrote in message
news:bisnp7$a4k$(E-Mail Removed)...
> 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.


Frankly, he's the one that sounds a bit pretentious. Assuming you are
writing OO code in C++, then using both the language of OO design and the
language of C++ implementation are valid. It doesn't make sense to be
pedantic and point out every time you make a comment that you're in the "OO
realm" or "C++ realm" at the moment. It's not pretentious at all to say
"message" or "method" when discussing a design implemented in C++. If there
is a difference between "method" and "function" in the context about which
I'm speaking, it would be that "method" is more abstract - in the OO sense -
and "function" is more concrete - in the C++ implementation sense.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
distinction between unzipping bytes and unzipping a file webcomm Python 10 01-10-2009 09:18 PM
Byters? Since the distinction between interpreters and compilers seems to be hazy sometimes, has anybody proposed a third distinction? Casey Hawthorne Java 4 10-20-2005 03:29 PM
distinction between float & int Ishwor Python 1 12-03-2004 02:09 PM
List and tuple usage distinction?? Ishwar Rattan Python 2 09-02-2004 01:12 AM
__contains__ vs has_key() - am I missing a subtle distinction? Skip Montanaro Python 1 10-20-2003 10:44 PM



Advertisments