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


Changing Inherited Implementations



Yüklə 0,84 Mb.
Pdf görüntüsü
səhifə229/294
tarix02.01.2022
ölçüsü0,84 Mb.
#41395
1   ...   225   226   227   228   229   230   231   232   ...   294
DelphiLanguageGuide

Changing Inherited Implementations
Descendant classes can change the way a specific interface method is implemented by overriding the implementing
method. This requires that the implementing method be virtual or dynamic.
A class can also reimplement an entire interface that it inherits from an ancestor class. This involves relisting the
interface in the descendant class' declaration. For example,
type
    IWindow = interface
    ['{00000115-0000-0000-C000-000000000146}']
    procedure Draw;
    .
    .
    .
end;
    TWindow = class(TInterfacedObject, IWindow)// TWindow implements IWindow
196


    procedure Draw;
    .
    .
    .
end;
TFrameWindow = class(TWindow, IWindow)// TFrameWindow reimplements IWindow
    procedure Draw;
    .
    .
    .
end;
Reimplementing an interface hides the inherited implementation of the same interface. Hence method resolution
clauses in an ancestor class have no effect on the reimplemented interface.

Yüklə 0,84 Mb.

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