Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > member functions

Reply
Thread Tools

member functions

 
 
Paul
Guest
Posts: n/a
 
      01-06-2011
A member functions is part of an object. true or false?

To me a member funtion is part of an object by definition.

However some people like to argue that a member function is not considered
part of an object.. They've suggested that because a function is not stored
within an object in memory thisa is evidence to suggest that an object does
not have member functions.

A member function is definined in an objects class
An objects' class is the definition of an object type and any functions
defined within that class are member of that given object type.
A member function IS by definition a member of an object.

It seems some people cannot see past the fact that a paragraph in the
standards states an object to be a region of memory. They seem to interpet
this to mean that nothing can be part of that object unless it is stored
within the same region of memory.
I have and I still do argue with these people as I think its quite clear
they're view is very narrow minded and not a good way to think about objects
and object types.





 
Reply With Quote
 
 
 
 
Bart van Ingen Schenau
Guest
Posts: n/a
 
      01-06-2011
On Jan 6, 12:27*pm, "Paul" <(E-Mail Removed)> wrote:
> A member functions is part of an object. true or false?


False.
A member function is part of a class. A class is not the same as an
object, but rather defines a possible type for an object.
A class provides a blueprint for the layout of an object and it tells
the compiler in which constructions an object of that type can be
used.

>
> To me a member funtion is part of an object by definition.


Then you are using different definitions that I am and the other C++
programmers that I know.

>
> However some people like to argue that a member function is not considered
> part of an object.. They've suggested that because a function is not stored
> within an object in memory thisa is evidence to suggest that an object does
> not have member functions.
>
> A member function is definined in an objects class
> An objects' class is the definition of an object type and any functions
> defined within that class are member of that given object type.
> A member function IS by definition a member of an object.


Sorry, but that conclusion does not follow from the preceding
statements.

First, member functions do not have to be defined in a class. It is
also possible to declare members in the class and define them outside
the class.

Secondly, a class provides indeed a definition of an object type, and
any function declared in the class is a member of the class. This is
true for both static and non-static members.

If your conclusion followed logically from the preceding statements,
then static member functions would also be members of an object, even
though they can be used without ever declaring an object of that type.
Additionally, there is a step missing where you show that members of a
class are by necessity also members of an instance of that class,
instead of operating on such an instance.

Bart v Ingen Schenau
 
Reply With Quote
 
 
 
 
Paul
Guest
Posts: n/a
 
      01-06-2011

"Bart van Ingen Schenau" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
On Jan 6, 12:27 pm, "Paul" <(E-Mail Removed)> wrote:
> A member functions is part of an object. true or false?


>False.


You are entitled to your opinion.

GL!

 
Reply With Quote
 
Victor Bazarov
Guest
Posts: n/a
 
      01-06-2011
On 1/6/2011 10:42 AM, Paul wrote:
> "Bart van Ingen Schenau" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> On Jan 6, 12:27 pm, "Paul" <(E-Mail Removed)> wrote:
>> A member functions is part of an object. true or false?

>
>> False.

>
> You are entitled to your opinion.


What does it have to do with opinions? A member function is a kind of
function. A function isn't an object, and as such cannot be a part of
another object.

V
--
I do not respond to top-posted replies, please don't ask
 
Reply With Quote
 
Paul
Guest
Posts: n/a
 
      01-06-2011

"Victor Bazarov" <(E-Mail Removed)> wrote in message
news:ig4orp$2n2$(E-Mail Removed)-september.org...
> On 1/6/2011 10:42 AM, Paul wrote:
>> "Bart van Ingen Schenau" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> On Jan 6, 12:27 pm, "Paul" <(E-Mail Removed)> wrote:
>>> A member functions is part of an object. true or false?

>>
>>> False.

>>
>> You are entitled to your opinion.

>
> What does it have to do with opinions? A member function is a kind of
> function. A function isn't an object, and as such cannot be a part of
> another object.
>



You refer to functions as objects yet in the same statement you clearly
state a function is not an object.
What you have stated here is nothing more than some twisted double negative

You also seem to have no regard for opinions

 
Reply With Quote
 
Victor Bazarov
Guest
Posts: n/a
 
      01-06-2011
On 1/6/2011 11:25 AM, Paul wrote:
>
> "Victor Bazarov" <(E-Mail Removed)> wrote in message
> news:ig4orp$2n2$(E-Mail Removed)-september.org...
>> On 1/6/2011 10:42 AM, Paul wrote:
>>> "Bart van Ingen Schenau" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>
>>> On Jan 6, 12:27 pm, "Paul" <(E-Mail Removed)> wrote:
>>>> A member functions is part of an object. true or false?
>>>
>>>> False.
>>>
>>> You are entitled to your opinion.

>>
>> What does it have to do with opinions? A member function is a kind of
>> function. A function isn't an object, and as such cannot be a part of
>> another object.
>>

>
>
> You refer to functions as objects yet in the same statement you clearly

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Where?

> state a function is not an object.


It is not, and I am basically repeating what the Standard says (see the
first Note in [intro.object/1]).

> What you have stated here is nothing more than some twisted double negative


Is English a language you've mastered? Perhaps I ought to use shorter
sentences? Let's try it again:

Only an object can be a part of another object. A function is NOT an
object. Hence a function cannot be a part of an object. There is
nothing in this that is an opinion. Those are just two facts and a
corollary.

> You also seem to have no regard for opinions


That's inconsequential to the matter at hand.

V
--
I do not respond to top-posted replies, please don't ask
 
Reply With Quote
 
Ulrich Eckhardt
Guest
Posts: n/a
 
      01-06-2011
Paul wrote:
> A member functions is part of an object. true or false?


In the context of the C++ object model, you have been given the answer
over and over.

Why are you asking again? Just read the existing answers.

> To me a member funtion is part of an object by definition.


By what definition?

 
Reply With Quote
 
Ulrich Eckhardt
Guest
Posts: n/a
 
      01-06-2011
Paul wrote:
> "Victor Bazarov" <(E-Mail Removed)> wrote in message
> news:ig4orp$2n2$(E-Mail Removed)-september.org...
>> What does it have to do with opinions? A member function is a kind of
>> function. A function isn't an object, and as such cannot be a part of
>> another object.

>
> You refer to functions as objects yet in the same statement you clearly
> state a function is not an object.


He does no such thing.


> You also seem to have no regard for opinions


Well, I wouldn't say so, he just doesn't have any for your opinions.
 
Reply With Quote
 
Ney André de Mello Zunino
Guest
Posts: n/a
 
      01-06-2011
Em 06/01/2011 15:03, Victor Bazarov escreveu:
> On 1/6/2011 11:25 AM, Paul wrote:
>>
>> You refer to functions as objects yet in the same statement you clearly

> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Where?


Judging from what the OP has shown so far, I wouldn't be surprised if he
derived (no pun intended) that conclusion from your sentence: "A member
function is a kind of function." IOW, you must only use the construction
"is a kinf of" to refer to objects in the OO sense; nowhere else. <g>

Haven't all this gone too far? Paul is surely entitled to his opinion. I
just think that his apparent goal of pushing his understanding of the
relationship between member functions and objects in the context of C++
will lead him nowhere.

Regards,

--
Ney André de Mello Zunino
 
Reply With Quote
 
Paul
Guest
Posts: n/a
 
      01-06-2011

"Ulrich Eckhardt" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)-berlin.de...
> Paul wrote:
>> "Victor Bazarov" <(E-Mail Removed)> wrote in message
>> news:ig4orp$2n2$(E-Mail Removed)-september.org...
>>> What does it have to do with opinions? A member function is a kind of
>>> function. A function isn't an object, and as such cannot be a part of
>>> another object.

>>
>> You refer to functions as objects yet in the same statement you clearly
>> state a function is not an object.

>
> He does no such thing.
>
>

He compares a function to 'another object'.

Are you people for real.

 
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
overloading non-template member functions with template member functions Hicham Mouline C++ 1 04-24-2009 07:47 AM
overloading non-template member functions with template member functions Hicham Mouline C++ 0 04-23-2009 11:42 AM
Defining Non-Member Functions for Template Member Types flounder C++ 4 04-01-2009 11:59 PM
Member function pointers to member functions with default arguments Hamish C++ 3 01-25-2008 06:46 AM
How would I use qsort to sort a struct with a char* member and a long member - I want to sort in order of the long member Angus Comber C Programming 7 02-05-2004 06:41 PM



Advertisments