Quote Originally Posted by oogabooga View Post
A "method" is an action that an object knows how to do to itself.

A "function" is an action that knows how to do something to an object.
I mostly agree on the first part, but on the second, I see it a quite bit differently.

From my perspective, I see a method as an operation that performs a task and returns no value, aside from indicating success or failure. I've always seen a function, in the context of an object, as an operation that may perform a task, but also definitely returns a value other than success or failure. I suppose that view of things may come from mathematics, where a function is defined as a mathematical operation that produces an output value, given a set of inputs. in mathematics, that output is always deteministic, but a function in a program need not be.

consider the following c++ class:
Code:
class dog
{
  public:
    void bark();
    int getAge();
};
in my example, I would call dog::bark() a method, but I would call dog::getAge() a function.