member functions

Discussion in 'C++' started by Paul, Jan 6, 2011.

  1. Paul

    Paul Guest

    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.
    Paul, Jan 6, 2011
    #1
    1. Advertising

  2. On Jan 6, 12:27 pm, "Paul" <> 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
    Bart van Ingen Schenau, Jan 6, 2011
    #2
    1. Advertising

  3. Paul

    Paul Guest

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


    >False.


    You are entitled to your opinion.

    GL!
    Paul, Jan 6, 2011
    #3
  4. On 1/6/2011 10:42 AM, Paul wrote:
    > "Bart van Ingen Schenau" <> wrote in message
    > news:...
    > On Jan 6, 12:27 pm, "Paul" <> 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
    Victor Bazarov, Jan 6, 2011
    #4
  5. Paul

    Paul Guest

    "Victor Bazarov" <> wrote in message
    news:ig4orp$2n2$-september.org...
    > On 1/6/2011 10:42 AM, Paul wrote:
    >> "Bart van Ingen Schenau" <> wrote in message
    >> news:...
    >> On Jan 6, 12:27 pm, "Paul" <> 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
    Paul, Jan 6, 2011
    #5
  6. On 1/6/2011 11:25 AM, Paul wrote:
    >
    > "Victor Bazarov" <> wrote in message
    > news:ig4orp$2n2$-september.org...
    >> On 1/6/2011 10:42 AM, Paul wrote:
    >>> "Bart van Ingen Schenau" <> wrote in message
    >>> news:...
    >>>
    >>> On Jan 6, 12:27 pm, "Paul" <> 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
    Victor Bazarov, Jan 6, 2011
    #6
  7. 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?
    Ulrich Eckhardt, Jan 6, 2011
    #7
  8. Paul wrote:
    > "Victor Bazarov" <> wrote in message
    > news:ig4orp$2n2$-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.
    Ulrich Eckhardt, Jan 6, 2011
    #8
  9. 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
    Ney André de Mello Zunino, Jan 6, 2011
    #9
  10. Paul

    Paul Guest

    "Ulrich Eckhardt" <> wrote in message
    news:-berlin.de...
    > Paul wrote:
    >> "Victor Bazarov" <> wrote in message
    >> news:ig4orp$2n2$-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.
    Paul, Jan 6, 2011
    #10
  11. Paul

    Paul Guest

    "Ney André de Mello Zunino" <> wrote in message
    news:ig4v7c$5j4$...
    > 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 havent shown you anything so far.
    You are obviously just another hostile asshole who is trying to jump on the
    bandwagon.
    Please note I object to idiots like you participating in my threads.
    Paul, Jan 6, 2011
    #11
  12. Em 06/01/2011 15:54, Paul escreveu:
    > "Ney André de Mello Zunino" <> wrote in message
    > news:ig4v7c$5j4$...
    >> 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 havent shown you anything so far.
    > You are obviously just another hostile asshole who is trying to jump on
    > the bandwagon.
    > Please note I object to idiots like you participating in my threads.


    And yet I was right on the money with my assumption. Thanks for
    confirming that. Your trolling efforts had been merely pathetic up to
    this point. They've now become predictable and boring.

    Worry not. This idiot will not reply to any of your posts from now on.
    Have a good one!

    --
    Ney André de Mello Zunino
    Ney André de Mello Zunino, Jan 6, 2011
    #12
  13. Paul

    Paul Guest

    "Ulrich Eckhardt" <> wrote in message
    news:-berlin.de...
    > 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.


    I have been given 'a' answer not 'the' answer .

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

    The definition of an Object type. Generally referred to as a class.
    Paul, Jan 6, 2011
    #13
  14. Paul

    Paul Guest

    "Ney André de Mello Zunino" <> wrote in message
    news:ig4vub$743$...
    > Em 06/01/2011 15:54, Paul escreveu:
    >> "Ney André de Mello Zunino" <> wrote in message
    >> news:ig4v7c$5j4$...
    >>> 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 havent shown you anything so far.
    >> You are obviously just another hostile asshole who is trying to jump on
    >> the bandwagon.
    >> Please note I object to idiots like you participating in my threads.

    >
    > And yet I was right on the money with my assumption. Thanks for confirming
    > that. Your trolling efforts had been merely pathetic up to this point.
    > They've now become predictable and boring.
    >
    > Worry not. This idiot will not reply to any of your posts from now on.
    > Have a good one!
    >
    > --
    > Ney André de Mello Zunino
    >


    Go away you nasty horrible person .....
    Paul, Jan 6, 2011
    #14
  15. * Paul, on 06.01.2011 18:52:
    >
    > "Ulrich Eckhardt" <> wrote in message
    > news:-berlin.de...
    >> Paul wrote:
    >>> "Victor Bazarov" <> wrote in message
    >>> news:ig4orp$2n2$-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.


    Victor just employed a way of speaking where one refers to some other's view.
    You can read the last part as a quote or paraphrase, ... like, <<as such cannot
    be a "part of another object">> (quoting or paraphrasing you, seeing things from
    your point of view). It's funny in its own way, you taking Victor's words
    literally, and most people here taking your words literally. :)

    As I wrote earlier, it's just about terminology, and possibly about ways of
    thinking about things.

    That's mostly off-topic in C++ newsgroups, because that terminology and/or way
    of thinking has nothing to do with any particular programming language: you can
    think that way and talk that way about things when using Java or Python or
    whatever programming language. "Mostly": it can be on-topic to ask whether this
    way of talking/thinking is common or suitable for C++ programming, and there you
    have your answer, namely that it's not common, and that it is in conflict with
    the standard's terminology, i.e. it's easy to misunderstand so it's not suitable
    either. So if you want people to understand you, then better define what you
    mean, or switch to the common terminology / way of thinking.


    Cheers & hth.,

    - Alf

    --
    blog at <url: http://alfps.wordpress.com>
    Alf P. Steinbach /Usenet, Jan 6, 2011
    #15
  16. Paul wrote:
    >
    > "Ulrich Eckhardt" <> wrote in message
    > news:-berlin.de...
    >> 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.

    >
    > I have been given 'a' answer not 'the' answer .


    Sorry, but that's wrong. You have been quoted the relevant section of the
    definition all over, you just don't want to or can't listen.

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

    >>
    >> By what definition?
    >>

    > The definition of an Object type. Generally referred to as a class.


    To me, too, methods are *generally* part of objects. However, in the
    context of the *C++ object model*, it isn't, by its definition the C++
    standard.

    Do you understand the difference between "in general" and "in the context
    of the C++ object model"?
    Ulrich Eckhardt, Jan 6, 2011
    #16
  17. Paul

    Paul Guest

    "Alf P. Steinbach /Usenet" <> wrote in
    message news:ig50l8$v51$-september.org...
    >* Paul, on 06.01.2011 18:52:
    >>
    >> "Ulrich Eckhardt" <> wrote in message
    >> news:-berlin.de...
    >>> Paul wrote:
    >>>> "Victor Bazarov" <> wrote in message
    >>>> news:ig4orp$2n2$-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.

    >
    > Victor just employed a way of speaking where one refers to some other's
    > view. You can read the last part as a quote or paraphrase, ... like, <<as
    > such cannot be a "part of another object">> (quoting or paraphrasing you,
    > seeing things from your point of view). It's funny in its own way, you
    > taking Victor's words literally, and most people here taking your words
    > literally. :)
    >
    > As I wrote earlier, it's just about terminology, and possibly about ways
    > of thinking about things.
    >
    > That's mostly off-topic in C++ newsgroups, because that terminology and/or
    > way of thinking has nothing to do with any particular programming
    > language: you can think that way and talk that way about things when using
    > Java or Python or whatever programming language. "Mostly": it can be
    > on-topic to ask whether this way of talking/thinking is common or suitable
    > for C++ programming, and there you have your answer, namely that it's not
    > common, and that it is in conflict with the standard's terminology, i.e.
    > it's easy to misunderstand so it's not suitable either. So if you want
    > people to understand you, then better define what you mean, or switch to
    > the common terminology / way of thinking.
    >
    >
    >
    > --


    As with the text from the standards that defines an object as region of
    storage. This is incorrectly being retranslated to mean something along the
    lines of ...
    an object cannot contain a member function.

    The standard also states that an object or subobject can be zero size, so
    how can a zero sized object be a region of storage? As this demonstrates the
    standards are not always simple to interpret, and peraps not always
    coherent.


    The problem with your argument is that selective quotes or one particular
    selective quote is being repeated misquoted to mean something it doesn't
    mean.
    All other statements in the standards seem to be ignored.
    For example paragraph 9.2 to which the standards seem to refer to as the
    definition of a member subobject:

    "1 The member-specification in a class definition declares the full set of
    members of the class; no member
    can be added elsewhere. Members of a class are data members, member
    functions (9.3), nested types,
    and enumerators."

    A member subobject is not necessarily the same thing as an object, defined
    as a region of storage.
    The term member is self descriptive and automatically implies that it's part
    of something.
    Another good point here is that the standard refers to class members to
    define objects or subobjects, therefore the standards clearly recognise the
    relationship between classes and objects , some people shun this idea.


    I think this makes my point clear that I am using the terminology as per the
    standards.
    The fact that a member function is listed where the standard defines the
    term member subobject can open up a whole new debate as to whether or not
    the standards regard a member function as a membersubobject. But as it
    stands it seems to do so.

    Please look at this quote from an OOP paper by Bjarne Strousup.

    "The function to be called depends on the type of the object for which it is
    called. This type cannot in general be determined until run time. Typically,
    the pointerp will be of some base classB and the object will be an object of
    some derived classD (as was the case with the base classshape and the
    derived classcircle above). The call mechanism must look into the object and
    find some information placed there by the compiler to determine which
    functionf is to be called"

    The author of the above quote suggests a call mechanism must look into an
    object to find some information regarding the function.

    All this evidence weighs strongly in favour that a member function can be
    considered part of an object.
    Paul, Jan 6, 2011
    #17
  18. Paul

    Paul Guest

    "Ulrich Eckhardt" <> wrote in message
    news:-berlin.de...
    > Paul wrote:
    >>
    >> "Ulrich Eckhardt" <> wrote in message
    >> news:-berlin.de...
    >>> 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.

    >>
    >> I have been given 'a' answer not 'the' answer .

    >
    > Sorry, but that's wrong. You have been quoted the relevant section of the
    > definition all over, you just don't want to or can't listen.
    >
    >>>> To me a member funtion is part of an object by definition.
    >>>
    >>> By what definition?
    >>>

    >> The definition of an Object type. Generally referred to as a class.

    >
    > To me, too, methods are *generally* part of objects. However, in the
    > context of the *C++ object model*, it isn't, by its definition the C++
    > standard.
    >
    > Do you understand the difference between "in general" and "in the context
    > of the C++ object model"?
    >
    >

    The C++ standards actually suggest that a member function IS part of an
    object, when it gives its definition of a member subobject ref:
    "1 The member-specification in a class definition declares the full set of
    members of the class; no member
    can be added elsewhere. Members of a class are data members, member
    functions (9.3), nested types,
    and enumerators."


    You suggest otherwise but you have not provided any quote to reference.
    Please can you give a quote from the standards that supports your claim.
    Paul, Jan 6, 2011
    #18
  19. Paul Reid <> wrote:
    > As with the text from the standards that defines an object as region of
    > storage. This is incorrectly being retranslated to mean something along
    > the lines of ...
    > an object cannot contain a member function.


    Aw, c'mon, it lists all possible things an object can contain. Is a member
    function among those?


    > The standard also states that an object or subobject can be zero size,
    > so how can a zero sized object be a region of storage?


    Read up on the so-called "empty baseclass optimization", it allows objects
    to effectively use no additional storage.


    > For example paragraph 9.2 to which the standards seem to refer to as the
    > definition of a member subobject:
    >
    > "1 The member-specification in a class definition declares the full set
    > of members of the class; no member can be added elsewhere. Members of a
    > class are data members, member functions (9.3), nested types,
    > and enumerators."
    >
    > A member subobject is not necessarily the same thing as an object,
    > defined as a region of storage.


    You quoted the definition of a subobject elsewhere already, it is an
    object and thus all restrictions of what constitutes an object apply. Also
    note that the above describes classes, not objects, in other words this is
    not an argument for or against your case.

    > All other statements in the standards seem to be ignored.


    Right, exactly that is what you do.


    > Another good point here is that the standard refers to class members
    > to define objects or subobjects, therefore the standards clearly
    > recognise the relationship between classes and objects , some people
    > shun this idea.


    I don't think anybody does. What people keep telling you is that there is
    no containment involved in the object/class relationship.


    > I think this makes my point clear that I am using the terminology as
    > per the standards. The fact that a member function is listed where the
    > standard defines the term member subobject can open up a whole new
    > debate as to whether or not the standards regard a member function as
    > a membersubobject. But as it stands it seems to do so.


    Class/object confusion, read it again.


    > Please look at this quote from an OOP paper by Bjarne Strousup.
    >
    > "The function to be called depends on the type of the object for which
    > it is called. This type cannot in general be determined until run time.
    > Typically, the pointer p will be of some base class B and the object
    > will be an object of some derived class D (as was the case with the
    > base class shape and the derived class circle above). The call mechanism
    > must look into the object and find some information placed there by the
    > compiler to determine which function f is to be called"
    >
    > The author of the above quote suggests a call mechanism must look into
    > an object to find some information regarding the function.


    This does not imply that the function is contained within the object.
    Also, not every function call uses dynamic dispatch and requires any
    information about the type in the object.


    > All this evidence weighs strongly in favour that a member function can
    > be considered part of an object.


    You can consider it part of an object. This distorted view will work in a
    few cases, but in other cases it will fail to correctly explain things,
    example:

    Base b;
    Derived d;
    b = d;
    b.some_function();

    Will the last function call invoke Base::some_function() or
    Derived::some_function()? If the member functions are part of the object,
    copying the object will also copy the functions. However, it doesn't, so
    this is something your distorted view doesn't explain. I'm not settling
    for your sub-par explanations, and you shouldn't either.
    Ulrich Eckhardt, Jan 6, 2011
    #19
  20. Paul Reid <> wrote:
    > The C++ standards actually suggest that a member function IS part of an
    > object, when it gives its definition of a member subobject ref:
    > "1 The member-specification in a class definition declares the full set
    > of members of the class; no member can be added elsewhere. Members of a
    > class are data members, member functions (9.3), nested types, and
    > enumerators."
    >
    > You suggest otherwise but you have not provided any quote to reference.


    Please make a full-text search in the above text for the word "object".
    Nothing found? Maybe that is because it doesn't describe what an object
    is? Do you grasp the difference between a class and an object?
    Ulrich Eckhardt, Jan 6, 2011
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hamish
    Replies:
    3
    Views:
    576
    Alf P. Steinbach
    Jan 25, 2008
  2. flounder
    Replies:
    4
    Views:
    509
    flounder
    Apr 2, 2009
  3. Hicham Mouline
    Replies:
    0
    Views:
    432
    Hicham Mouline
    Apr 23, 2009
  4. Hicham Mouline
    Replies:
    1
    Views:
    415
    Michael DOUBEZ
    Apr 24, 2009
  5. paul
    Replies:
    8
    Views:
    707
    Alf P. Steinbach
    Apr 30, 2009
Loading...

Share This Page