.


:




:

































 

 

 

 


( , GUID, , ).




, , , , , . , interface (). .

, . , :

1) interface , . , Delphi ; ;

2) , ;

3) , TObject, IInterface, .

, . . . , , . :

Type

ICanFly = interface

[{EAD9C4B4-E1C5-4CF4-9FA0-3B812C880A21}]

function Fly: string;

end;

(Globally Unique Identifier, GUID) , , Windows-. Delphi Ctrl+Shift+G.

: GUID, , as . () ; , , GUID .

, :

Type

TAirplane = class (IInterfacedObject, ICanFly)

function Fly: string;

end;

RTL , IInterface. IInterfacedObject.

( ) . - override . , - , . , - , . . , , , :

Var

Flyer1: ICanFly;

Begin

Flyer1:= TAirplane.Create;

Flyer.Fly;

End;

, Delphi as , . :

Flyer1:= TAirplane.Create as ICanFly;

as, Delphi : _AddRef ( IInterface). , , IInterfacedObject, , , , . , , .

, , , Delphi . , .

 





:


: 2016-11-19; !; : 449 |


:

:

, .
==> ...

1713 - | 1531 -


© 2015-2024 lektsii.org - -

: 0.012 .