Использование ключевого слова implements
Листинг 10.5. Использование ключевого слова implements
unit cadapt; type
IRGB8bit = interface
['{1d76360a-f4f5-lldl-87d4-00c04fbl7199}']
function Red: Byte;
function Green: Byte;
function Blue: Byte; end;
IColorRef = interface
['{ld76360b-f4f5-11dl-87d4-00c04fbl7199}']
function Color: Integer; end;
TRGB8ColorRefAdapter = class(TInterfacedQbject, IRGB8bit, IColorRef) private
FRGB8bit: IRGB8bit;
FPalRelative: Boolean; public
constructor Create(rgb: IRGB8bit);
property RGB8Intf: IRGB8bit read FRGB8bit implements IRGB8bit;
property PalRelative: Boolean read FPalRelative write FPalRelative; function Color: Integer; end; implementation
constructor TRGB8ColorRefAdapter.Create(rgb: IRGB8bit);
begin
FRGB8bit := rgb; end;
function TRGB8ColorRefAdapter.Color: Integer; begin
if FPalRelative then
Result := PaletteRGB(RGB8Intf.Red, RGB8Intf.Green, RGB8Intf.Blue) else Result := RGB(RGB8Intf,Red, RGB8Intf.Green, RGB8Intf.Blue);
end; end.