Difference between revisions of "Method"

From Lazarus wiki
Jump to navigationJump to search
(Fix definition)
(remove Category:Control Structures; add →‎self identifier: ; more concise definition)
Line 1: Line 1:
 
{{Method}}
 
{{Method}}
  
== Definition ==
+
A '''method''' is a [[Routine|routine]] that is associated with an [[Object|<syntaxhighlight lang="pascal" enclose="none">object</syntaxhighlight>]] or [[Class|<syntaxhighlight lang="pascal" enclose="none">class</syntaxhighlight>]].
A '''method''' is a [[Procedure|procedure]] or [[Function|function]] that is associated with an [[object]] class.
+
 
 +
== self identifier ==
 +
Inside method definitions the special identifier <syntaxhighlight lang="pascal" enclose="none">self</syntaxhighlight> is available.
 +
In static or class methods it identifies the <syntaxhighlight lang="pascal" enclose="none">object</syntaxhighlight>/<syntaxhighlight lang="pascal" enclose="none">class</syntaxhighlight> type itself.
 +
In instance methods <syntaxhighlight lang="pascal" enclose="none">self</syntaxhighlight> identifies the very instance.
 +
 
 
[[Category:Pascal]]
 
[[Category:Pascal]]
[[Category:Control Structures]]
 

Revision as of 00:40, 25 May 2018

English (en) français (fr) русский (ru)

A method is a routine that is associated with an object or class.

self identifier

Inside method definitions the special identifier self is available. In static or class methods it identifies the object/class type itself. In instance methods self identifies the very instance.