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
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
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
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.
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*?.
Comment