Method (computer programming): Difference between revisions

Content deleted Content added
m Rollback edit(s) by 42.109.129.201 (talk): test edits (RW 16.1)
m used correct term
Tags: Mobile edit Mobile app edit iOS app edit
Line 1:
{{short description|Computer function or subroutine that is tied to a particular instance or class}}
 
A '''method''' in [[object-oriented programming]] (OOP) is a [[Procedure (computer science)|procedure]] associated with a [[Message passing|message]] and an [[Object (computer science)|object]]. An object consists of ''data'' and ''behavior''; these comprisecompose an [[Interface (computing)|''interface'']], which specifies how the object may be utilized by any of its various consumers.<ref name="consumerdef001a">Consumers of an object may consist of various kinds of elements, such as other programs, remote computer systems, or computer programmers who wish to utilize the object as part of their own programs.</ref>
 
Data is represented as [[Property (programming)|properties]] of the object, and behaviors are represented as methods. For example, a <code>Window</code> object could have methods such as <code>open</code> and <code>close</code>, while its state (whether it is open or closed at any given point in time) would be a property.