Delphi Language Guide Delphi for Microsoft Win32 Delphi for the Microsoft. Net framework



Yüklə 0,84 Mb.
Pdf görüntüsü
səhifə160/294
tarix02.01.2022
ölçüsü0,84 Mb.
#41395
1   ...   156   157   158   159   160   161   162   163   ...   294
DelphiLanguageGuide

About Methods
Within a class declaration, methods appear as procedure and function headings, which work like forward
declarations. Somewhere after the class declaration, but within the same module, each method must be implemented
by a defining declaration. For example, suppose the declaration of 
TMyClass
 includes a method called
DoSomething
:
type 
   TMyClass = class(TObject) 
      ... 
      procedure DoSomething; 
      ... 
   end;
A defining declaration for 
DoSomething
 must occur later in the module:
procedure TMyClass.DoSomething; 
begin 
     ... 
end;
While a class can be declared in either the interface or the implementation section of a unit, defining declarations
for a class' methods must be in the implementation section.
In the heading of a defining declaration, the method name is always qualified with the name of the class to which it
belongs. The heading can repeat the parameter list from the class declaration; if it does, the order, type and names
of the parameters must match exactly, and if the method is a function, the return value must match as well.
Method declarations can include special directives that are not used with other functions or procedures. Directives
should appear in the class declaration only, not in the defining declaration, and should always be listed in the following
order:
reintroduce; overload; binding; calling convention;abstract; warning
where binding is virtual, dynamic, or override; calling convention is register, pascal, cdecl, stdcall, or safecall; and
warning is platform, deprecated, or library.
140



Yüklə 0,84 Mb.

Dostları ilə paylaş:
1   ...   156   157   158   159   160   161   162   163   ...   294




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin