[fpc-pascal] Multiple active class helpers at same time
Maciej Izak
hnb.code at gmail.com
Mon Apr 23 14:18:22 CEST 2018
2018-04-23 14:02 GMT+02:00 LacaK <lacak at zoznam.sk>:
> Can you give small example for my use case ? I can not understand from
> above mentioned examples.
>
unit A;
type
TClassA = class
public
procedure Method1;
end;
unit B;
type
TClassAHelper1<T> = record
private
instance: T default;
public
procedure MethodB1;
procedure MethodB2;
end;
unit C;
type
TClassAHelper2<T> = record
private
instance: T default;
public
procedure MethodC1;
procedure MethodC2;
end;
and in program:
use A,B,C;
var instanceA: TClassAHelper1<TClassAHelper2<TClassA>>; // it can be
composed in other way (more elegant for example as specialization in new
type)
...
instanceA := TClassA.Create;
instanceA.Method1;
instanceA.MethodB1; // defined in unit B
instanceA.MethodC1; // defined in unit C
--
Best regards,
Maciej Izak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20180423/63a72bb0/attachment.html>
More information about the fpc-pascal
mailing list