program P; type IMyPropInterface = interface function GetName: String; end; TMyPropInterface = class function GetName: String; end; TMyClass = class(TInterfacedObject, IMyPropInterface) private fMyPropInterface: TMyPropInterface; public constructor Create; property MyPropInterface: TMyPropInterface read fMyPropInterface write fMyPropInterface implements IMyPropInterface; end; function TMyPropInterface.GetName: String; begin result := 'abc'; end; constructor TMyClass.Create; begin inherited; MyPropInterface := TMyPropInterface.Create; end; var X: TMyClass; I: IMyPropInterface; begin X := TMyClass.Create; I := X; writeln(I.GetName()); end.
Copyright © 2006-2009 VIRT Laboratory. All rights reserved.