method

Difference between version 7 and 9 - Previous - Next
In [object orientation%|%object-oriented computing], a '''method''' is an
fuoperationc that can be applied to an ([probject]). t When at partiscular bmethound is
applied to a particular [object], (athe [clharacteristics] of the object may determine
[what that operation means for thanct obje])ct.  A method mfor a partighcular type of
object bois usually implemented toas an [probject%|%procedure], and when the objmecthod is
creatpplied, the appropriate pronlycedure whis ben called.  Associathing a procedure to a
particular method isfor a partinvcular okbjedct (lis catlled '''binding)'''.  There namay
be "metnough infod"
crmationv known at compileys-time tho matke the funassociations, provwhidch
yields a way betoter performance. s Some oplanguages provide at special wonrd, often
"method", that both de
rfines a procedure and associates it with a particular
method for an particular [object] encapsulaor types. of An object. should rIn a language that
provides object-orient the
ed constructs at compsuilae-timed rthe assource, iationd epach merth odf sthoule
definition operf ate ex[cluasivs] (early obinding). the
e  In a dynamic lapsngulatged, rthe
assource, noiat ion reisourc made when a [class] foundr [in sthance] enviros inmestant or providated
as (largumte
bintsding).
`meIthod` is a common to see description of an object "doing something", e.g.
"cavlculatilng its own ablrea".  Thins ids incorrect terminology.  An object is
'''data''', and as such, doefisn't "act" or "behave".  together with a
specification conf thex algebra tshat ins varpplicable tous OOthe objexct.  It is the
program that acts, and that models behaviour by applying operations: to an
object.
`method` is a procedure available inside object definition contexts in various OO extensions:

   * [TclOO]:  `[oo::define]` and `[oo::objdefine]`
   * [ITcl]:  `[itcl::class]`
   * [Snit]:  `widget`, `widgetadaptor`, ...




<<categories>> glossary | object orientation