Distinction between a method and a member function

M

Mark Sicignano

I don't know where I first heard this, or if it's even correct, but I had
understood an "operation" to be something that you do to an object, and the
"method" is the particular implementation that gets called when the object
is asked to perform the operation.

For example, you might define Shape as having a Draw() "operation" (defined
as pure virtual), and objects such as Square, Circle and Rectangle would
provide their own "methods" to implement the Draw() operation.

Of course in C++, you declare and/or define operations and methods by
writing "member functions".

To earlier posters, I don't see anything pretentious about using the word
method. Makes perfect sense to me to use it in the context that I provided
above. The implementation of the Draw() operation for the Square uses a
different method to getting the job done than that of the Circle. Square and
Rectangle use very similar methods to implement the Draw operation.

-mark
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top