I am trying to do the following in Delphi 10.1 Berlin, but the compiler returns the message "Internal error F2084: AV0A785E48-R000000-10-0":
TMyType = (mtValue1, mtValue2); TMyBaseClass = class private FMyType: TMyType; public property MyType: TMyType read FMyType write FMyType; end; TMyClass = class(TMyBaseClass) private FOtherField: Integer; public property OtherField: Integer read FOtherField write FOtherField; end; TMyBaseProcess1<T: TMyBaseClass> = class strict private FMyClass: T; strict protected type TMyTypeHelper = record Helper for TMyType public function ToString: string; end; public constructor Create(AMyClass: T); procedure DoSomething; end; TMyProcess1 = class(TMyBaseProcess1<TMyClass>) end; TMyBaseProcess2<T: TMyBaseClass> = class strict private FMyClass: T; strict protected type TMyTypeHelper = record Helper for TMyType public function ToInteger: Integer; end; public constructor Create(AMyClass: T); procedure DoSomethingElse; end; TMyProcess2 = class(TMyBaseProcess2<TMyClass>) end;
The helper in TMyBaseProcess1 is completely different from the helper in TMyBaseProcess2. I can separate the helper and the class without any problems. I just want to know why I can't leave them together.
Does anyone know what the problem is? Can I use generics, nested helper and inheritance of records this way?
generics inheritance delphi record helper
Lucas Felipe Silva
source share