i have a base class and 10 class derived from that class. Base class contain a function that except parameter of type procedure of object
. like this
mytype = procedure (a : integer) of object;
baseclass = class
public
procedure myproc(cont handler : mytype ) ;
end;
procedure baseclass.myproc(cont handler : mytype ) ;
begin
// do something
end;
i am overloading this function in derived class i.e derived class contain same function but with different parameter (procedure ( const handler : integer ) of object ). like this
base1mytype = procedure (a : string) of object;
derivedclass1 = class(baseclass)
public
procedure myproc(cont handler : base1mytype ) ;overload;
end;
base2mytype = procedure (a : boolean) of object;
derivedclass1 = class(baseclass)
public
procedure myproc(cont handler : base2mytype ) ;overload;
end;
and so on.........
All i want a generic class that implement this function and i derive my classes from that function eg
mytype = procedure (a : integer) of object;
baseclass<T> = class
public
procedure myproc(cont handler : T) ;
end;
procedure baseclass<T>.myproc(cont handler : T ) ;
begin
// do something
end;
and derive classes are like this
deriveclass1 = class<baseclass <string>>
public
procedure myproc(cont handler : T) ;
end;
Since generic constraint does not support constrain of type procedure of object