468,491 Members | 2,022 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,491 developers. It's quick & easy.

method & function

Hi,

What's the difference between method & funciton in class concept in
C++?

Thanks in advance,
Michael

Aug 3 '06 #1
9 7620
Michael schrieb:
Hi,

What's the difference between method & funciton in class concept in
C++?
There are no methods in C++. There are only functions. What do you mean?

--
Thomas
Aug 3 '06 #2
Co-ask, and what is the difference between 'variable' and 'attribute'?
I just saw these two in one article (global variable, static
attribute). Thanks.

Michael wrote:
Hi,

What's the difference between method & funciton in class concept in
C++?

Thanks in advance,
Michael
Aug 3 '06 #3
Michael wrote:
What's the difference between method & funciton in class concept in
C++?
There is a *method* to this madness...

Generally, a class contains member *functions* along with data members.
Data members represent objects in memory, member *functions* provide
the object's (class') behaviour.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Aug 3 '06 #4
Daniel Smith wrote:
Co-ask, and what is the difference between 'variable' and 'attribute'?
I just saw these two in one article (global variable, static
attribute). Thanks.
Please do not top-post.

'Variable' is not a C++ term. It's a generic programming term and it
designates an object that can change its value during the execution
of the program. For example, a reference is not really a variable,
since it cannot change what it refers to, once initialised.

"Attribute"? I am not sure I've heard it in any C++ context. It could
be a synonym for "trait", and there are "type traits" in C++...
Michael wrote:
>Hi,

What's the difference between method & funciton in class concept in
C++?

Thanks in advance,
Michael
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Aug 3 '06 #5
In article <11*********************@b28g2000cwb.googlegroups. com>,
"Michael" <mi*******@gmail.comwrote:
Hi,

What's the difference between method & funciton in class concept in
C++?
"Method" is not used in C++. We use the term "member-function".
Aug 3 '06 #6
Michael wrote:
Hi,

What's the difference between method & funciton in class concept in
C++?

Thanks in advance,
Michael
None in my opinion, but some people reserve the term "method" to refer
specifically to virtual functions (but this is OO lingo, not C++
terminology).
Aug 3 '06 #7
Michael wrote:
What's the difference between method & funciton in class concept in
C++?
All named blocks of code - named with a linkable entry point like foo() -
are either functions, constructors, or destructors. (The Standard sez
constructors and destructors are not functions. They are blocks of code that
bind to object lifespans.)

A function inside a class is a member function.

When using OO design, we send "messages" to objects, and they respond with
"methods". These words are jargon and have no fixed meaning. Roughly, the
message is often the name of a member function, as invoked, such as
anObject.foo(). Then the method is the contents of Object::foo().

And sometimes we say "method" to mean a virtual member function. Yet again
nothing defines these words but their contexts.

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Aug 3 '06 #8
Daniel T. wrote:
"Method" is not used in C++. We use the term "member-function".
Do as he say, not as he do. ;-)

http://groups.google.com/groups?q=%2...method+c%2B%2B

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Aug 3 '06 #9
"Michael" writes:
What's the difference between method & funciton in class concept in
C++?
Method is Smalltalk speak for what C++ calls a member function. I prefer
the Smalltalk terminology, why use a two word phrase when there is a
perfectly adequate *word*?.
Aug 3 '06 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Billy Boone | last post: by
27 posts views Thread by Daniel Vallstrom | last post: by
14 posts views Thread by Arne | last post: by
2 posts views Thread by FP | last post: by
3 posts views Thread by gieforce | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.