Synonym: message


Booch says, a method is

"An operation upon an object, defined as part of the declaration of a class; [...]"

[BOO91, p. 515]

The methods, defined in a class, indicate, what the instantiated objects are able to do.

An object's method is called by other objects of the system.


As Campione and Walrath explain:

"Three components comprise a message:

1. the object to whom the message is addressed

2. the name of the method to perform

3. any parameters needed by the method"

[CW96, "What are messages?"]

As mentioned before, we want to change our car's speed. To achieve this, the car's driver (also an object) has to call the "accelerate" method:

Using the "accelerate" method of the object MyCar
Using the "accelerate" method of the object MyCar

As the figure shows, the "accelerate" method was called with the parameter "80", which indicates the desired speed. By applying that method, the value of the variable "speed" had been changed. You don't change the state of an object (its variables) directly.


The fact that variables of an object are invisible to the outside is called encapsulation.

Neural Net Components in an Object Oriented Class Structure