Einzelnen Beitrag anzeigen

Benutzerbild von Stevie
Stevie

Registriert seit: 12. Aug 2003
Ort: Soest
4.009 Beiträge
 
Delphi 10.1 Berlin Enterprise
 
#2

AW: Helfer funktioniert nicht bei statischen Record-Methoden

  Alt 17. Jul 2015, 18:46
Delphi-Quellcode:
type
   TSomeRecord = record
      strict private class procedure StaticMethod(); static;
   end;

   TSomeRecordHelper = record helper for TSomeRecord
      private procedure __StaticMethod(); inline;
      public class procedure _StaticMethod(); static; inline;
   end;

{ TSomeRecord }

class procedure TSomeRecord.StaticMethod();
begin
   //
end;

{ TSomeRecordHelper }

class procedure TSomeRecordHelper._StaticMethod();
var
  Self: TSomeRecord;
begin
  Self.__StaticMethod;
end;

procedure TSomeRecordHelper.__StaticMethod;
begin
  TSomeRecord.StaticMethod;
end;
Stefan
“Simplicity, carried to the extreme, becomes elegance.” Jon Franklin

Delphi Sorcery - DSharp - Spring4D - TestInsight

Geändert von Stevie (17. Jul 2015 um 18:52 Uhr)
  Mit Zitat antworten Zitat