Method
<programming> The name given in
Smalltalk and other object-oriented languages to a procedure or routine associated with one or more classes.
An
object of a certain class knows how to perform actions, e.g. printing itself or creating a new instance of itself, rather than the function (e.g. printing) knowing how to handle different types of object.
Different classes may define methods with the same name (i.e. methods may be
polymorphic).
The term "method" is used both for a named operation, e.g. "PRINT" and also for the code which a specific class provides to perform tha t operation.
Most methods operate on objects that are instances of a certain class.
Some object-oriented languages call these "object methods" to distinguish then from "class methods".
In
Smalltalk, a method is defined by giving its name, documentation, temporary local variables and a sequence of expressions separated by "."s.