
- Код: Выделить всё
unit Prim;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Graphics, GeomUtils, TR_ColorInterface, TR_DrawableInterface;
type
TPrimitive = class(TR_IDrawable)
private
FPoints : array of TPointF;
FNPoints : Integer;
FColor : TR_IColor;
FThickness : Integer;
FDashSize : Integer;
FDashSpace : Integer;
public
constructor Create;
procedure Draw(); virtual; abstract;
function GetBBox() : TRectF; virtual; abstract;
end;
////////////////////////////////////////////////////////////////////////////////
implementation
constructor TPrimitive.Create();
begin
FNPoints := 0;
FThickness := 1;
FDashSize := 1;
FDashSpace := 1;
end;
end.
интерфейс от которого наследуюсь:
- Код: Выделить всё
unit TR_DrawableInterface;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, GeomUtils;
type
TR_IDrawable = interface
procedure Draw();
function GetBBox() : TRectF;
end;
implementation
end.
Сообщение при компиляции:
tr_drawableinterface.pas(8,35) Hint: Unit "TR_GraphicInterface" not used in TR_DrawableInterface
prim.pas(12,18) Error: No matching implementation for interface method "IUnknown.QueryInterface(constref TGuid,out <Formal type>):LongInt; StdCall;" found
prim.pas(12,18) Error: No matching implementation for interface method "IUnknown._AddRef:LongInt; StdCall;" found
prim.pas(12,18) Error: No matching implementation for interface method "IUnknown._Release:LongInt; StdCall;" found
prim.pas(29,1) Fatal: There were 3 errors compiling module, stopping
Что за IUnknown.QueryInterface().... Откуда взялось?

Сразу спрошу, чтобы мне сделать абстрактный класс, достаточно просто один из его методов сделать абстрактным? Зачем мне у такого класса имплементировать конструктор (без этого ругается)