Einzelnen Beitrag anzeigen

Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#8

AW: Strings nur einmalig im Code verwenden - Zugriff

  Alt 12. Aug 2016, 13:45
Zitat von http://edn.embarcadero.com/article/34324:
Classes can now have class constants -- a constant value associated with the class itself and not an instance of the class.
Delphi-Quellcode:
type
  TClassWithConstant = class
    public
      const SomeConst = 'This is a class constant';
  end;
         

procedure TForm1.FormCreate(Sender: TObject);
begin
  ShowMessage(TClassWithConstant.SomeConst);
end;
In nicht ganz so alten Delphi Versionen sollte das da gehen. Wobei es bei meinem Delphi 7 nicht geht obwohl auf der Seite steht dass es ab Delphi 7 geht (oder hab ich was falsch verstanden?)
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
  Mit Zitat antworten Zitat