Hi,
i got the Runtime Error: Call to abstract method
Main file
program fluent_interfaces_1;
{$interfaces CORBA}
uses MapBuilder0_fluent , MapBuilder0Impl_fluent , MapBuilderAction_fluent ;
type
TMapBuilder0Impl =specialize MapBuilder0Impl<String,Integer>;
TMapBuilderAction=specialize MapBuilderAction<String,Integer>;
MapB = class(TMapBuilder0Impl)
constructor Create;
end;
MapBuilderImpl = class(TMapBuilderAction )
public
procedure put( key:String; value:Integer); override;
end;
//MapB
Constructor MapB.Create;
var
myaction:TMapBuilderAction;
begin
myaction:=TMapBuilderAction.Create;
Inherited create(myaction);
end;
//MapBuilderImpl
procedure MapBuilderImpl.put( key:String; value:Integer);
begin
WriteLn('PUT');
end;
begin
MapB.Create().put('Hallo',0).put('Hallo',1);
readln();
end.
MapBuilder0_fluent
unit MapBuilder0_fluent;
//generateIState
{$interfaces CORBA}
interface
type
generic MapBuilder0 <K, V>= interface
function put( key:K; value:V):specialize MapBuilder0<K, V>;
End;
implementation
End.
MapBuilder0Impl_fluent
unit MapBuilder0Impl_fluent;
//generateState
interface
uses MapBuilderAction_fluent , MapBuilder0_fluent;
Type
generic MapBuilder0Impl <K, V>= Class(TInterfacedObject,specialize MapBuilder0<K, V>)
private
action:specialize MapBuilderAction<K, V>;
public
Constructor Create(myaction:specialize MapBuilderAction<K, V>);
function build():Integer;
procedure print();
function put( key:K; value:V):specialize MapBuilder0<K, V>;
End;
implementation
Constructor MapBuilder0Impl.Create(myaction:specialize MapBuilderAction<K, V>);
Begin
Self.action := myaction;
End;
function MapBuilder0Impl.put( key:K; value:V):specialize MapBuilder0<K, V>;
Begin
Self.action.state0_put(key, value);
exit( MapBuilder0Impl.Create(Self.action));
End;
End.
MapBuilderAction_fluent
unit MapBuilderAction_fluent;
//generateIAction
interface
type
generic MapBuilderAction <K, V>= Class Abstract
procedure state0_put( key:K; value:V);
procedure put( key:K; value:V); virtual; abstract;
End;
implementation
procedure MapBuilderAction.state0_put( key:K; value:V);
Begin
put(key, value);
End;
End.
in the procedure procedure MapBuilderAction.state0_put( key:K; value:V); i got the Error.
i do not see, why it not calls MapBuilderImpl.put( key:String; value:Integer)
and how can i solve the Problem?