Wie komme ich mit einem Record-Helfer an private statische Methoden des Records?
Delphi-Quellcode:
type
TSomeRecord = record
strict private procedure instanceMethod();
strict private class procedure StaticMethod(); static;
end;
TSomeRecordHelper = record helper for TSomeRecord
public procedure _instanceMethod();
public class procedure _StaticMethod(); static;
end;
TMyObject = class(TObject)
strict private class procedure StaticMethod(); virtual; abstract;
end;
{ TSomeRecord }
procedure TSomeRecord.instanceMethod();
begin
//
end;
class procedure TSomeRecord.StaticMethod();
begin
//
end;
{ TSomeRecordHelper }
procedure TSomeRecordHelper._instanceMethod();
begin
self.instanceMethod(); // Das klappt schonmal...
end;
class procedure TSomeRecordHelper._StaticMethod();
begin
//self.StaticMethod(); // E2003: Undeklarierter Bezeichner "self"
//StaticMethod(); // E2003: Undeklarierter Bezeichner "StaticMethod"
//TSomeRecord.StaticMethod(); // E2361 Auf private-Symbol TSomeRecord.StaticMethod kann nicht zugegriffen werden
//inherited StaticMethod(); // E2075 Diese Form des Methodenaufrufs ist nur in Methoden von abgeleiteten Typen erlaubt
raise EProgrammerNotFound.Create('Delphi-Praxis, zu Hilfe!');
end;