Skip to content
EntityQ815844· pop 31· linked from 345 articles

Also known as member function, class method, method of a class, method on a class, instance method

computer function or subroutine that is tied to a particular instance or class

~11 min read

Encyclopedic overview

A method in object-oriented programming (OOP) is a procedure associated with an object, and generally also a message. An object consists of state data and behavior; these compose an interface, which specifies how the object may be used. A method is a behavior of an object parametrized by a user.

Data is represented as properties of the object, and behaviors are represented as methods. For example, a Window object could have methods such as open and close, while its state (whether it is open or closed at any given point in time) would be a property.

Excerpted from Wikipedia’s “method” article, available under the CC BY-SA 4.0 licence.