A method is a procedure or function declared inside an object type declaration.


 procedure Method(Param1, Param2: Integer);


Methods can access the object's data fields without having them passed to it as parameters.

The declaration inside the object type declaration consists of the header only.

The body of the method is defined outside the object type declaration. Its header must contain the name of the object type it is bound to, like this:

   procedure ObjectType.Method(Param1, Param2: Integer);
   end;  (* Method *)

Methods can be static, virtual, or dynamic.

In addition to regular procedures and functions, object-oriented Pascal includes two special method types: constructor and destructor.

Within a method, a function call or procedure statement allows a qualified method designator to denote activation of a specific method. This type of call is known as a qualified method activation.

See Also


| G+
Код для вставки: :: :: :: ::
Поделиться: // //