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ə228/294
tarix02.01.2022
ölçüsü0,84 Mb.
#41395
1   ...   224   225   226   227   228   229   230   231   ...   294
DelphiLanguageGuide

Method Resolution Clause
You can override the default name-based mappings by including method resolution clauses in a class declaration.
When a class implements two or more interfaces that have identically named methods, use method resolution
clauses to resolve the naming conflicts.
A method resolution clause has the form
procedure interface.interfaceMethod = implementingMethod;
or
function interface.interfaceMethod = implementingMethod;
where implementingMethod is a method declared in the class or one of its ancestors. The implementingMethod can
be a method declared later in the class declaration, but cannot be a private method of an ancestor class declared
in another module.
For example, the class declaration
type
    TMemoryManager = class(TInterfacedObject, IMalloc, IErrorInfo)
    function IMalloc.Alloc = Allocate;
    procedure IMalloc.Free = Deallocate;
    .
    .
    .
end;
maps 
IMalloc
's 
Alloc
 and 
Free
 methods onto 
TMemoryManager
's 
Allocate
 and 
Deallocate
 methods.
A method resolution clause cannot alter a mapping introduced by an ancestor class.

Yüklə 0,84 Mb.

Dostları ilə paylaş:
1   ...   224   225   226   227   228   229   230   231   ...   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