Method (computer programming): Difference between revisions

Content deleted Content added
Fixing first sentence
Line 1:
{{short description|Function that is tied to a particular instance or class}}
 
A '''method''' in [[object-oriented programming]] (OOP) is a [[Procedure (computer science)|procedure]] associated with aan [[MessageObject passing(computer science)|messageobject]], and angenerally also a [[ObjectMessage (computer science)passing|objectmessage]]. An object consists of ''state data'' and ''behavior''; these compose an [[Interface (computing)|''interface'']], which specifies how the object may be utilized by any of its various consumers. A method is a behavior of an object parametrized by a consumer.
 
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.