method & function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michael

    #1

    method & function

    Hi,

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

    Thanks in advance,
    Michael

  • Thomas J. Gritzan

    #2
    Re: method & function

    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

    Comment

    • Daniel Smith

      #3
      Re: method & function

      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

      Comment

      • Victor Bazarov

        #4
        Re: method & function

        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


        Comment

        • Victor Bazarov

          #5
          Re: method & function

          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


          Comment

          • Daniel T.

            #6
            Re: method & function

            In article <1154576704.483 175.75950@b28g2 000cwb.googlegr oups.com>,
            "Michael" <michaelnx@gmai l.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".

            Comment

            • Mark P

              #7
              Re: method &amp; function

              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).

              Comment

              • Phlip

                #8
                Re: method &amp; function

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


                Comment

                • Phlip

                  #9
                  Re: method &amp; function

                  Daniel T. wrote:
                  "Method" is not used in C++. We use the term "member-function".
                  Do as he say, not as he do. ;-)



                  --
                  Phlip
                  http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!


                  Comment

                  • osmium

                    #10
                    Re: method &amp; function

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


                    Comment

                    Working...