This will fail on syntax, and a lot more....:
type
class c1 // unless you use macro's this is not pascal
begin
function f(f1: double): double;
end;
But it is possible. Add example later when I cleaned up your code.
[edit] cleaned up, do you mean this:
{$mode objfpc}
uses generics.collections;
type
c1 = class abstract
Protected
_dl: double;
public
function f(f1: double): boolean;virtual;abstract;
property dl: double read _dl;
end;
c2 = class(c1)
Public
constructor Create(d1, d2: double);
function f(f1: double): boolean; override;
end;
Tc2List = specialize TObjectList<c1>;
constructor c2.Create(d1, d2: Double);
begin
inherited create;
_dl := d1+d2;
end;
function c2.f(f1: double): Boolean;
begin
if(_dl = f1) then result := true
else result := false;
end;
var
Objectlist:Tc2List;
i:integer;
begin
ObjectList := Tc2List.Create;
for i := 0 to 99 do
Objectlist.add(c2.Create(random,random));
for i := 0 to 99 do
writeln(ObjectList[i].dl:2:2);
Objectlist.free;
end.
Because that is Object Pascal and we can work from there.
Although this is working, what is the point?
There are so many mistakes in the question code.
I hope this helps you. Also with the l and 1.