btaunique.blogg.se

Delphi xe10 static function in class
Delphi xe10 static function in class











delphi xe10 static function in class delphi xe10 static function in class

You need to end the block with "var" if you wish to include other fields after it (otherwise the block may be ended by a "private", "public", "procedure" etc specifier). The keywords you are looking for are "class var" - this starts a block of class variables in your class declaration. Then FLogger := TSomeLogLoggerClass.Create Property Logger : TLogLogger read GetLogger write SetLogger You could also set up default instance handling.

delphi xe10 static function in class

Change it in one of the children, and it changes for all descendant instances. Note that this class variable will be writable from any class instance, hence you can set it up somewhere else in the code, usually based on some condition (type of logger etc.).Įdit: It will also be the same in all descendants of the class. Procedure TMyObject.SetLogger(value:TLogLogger) Property Logger : TLogLogger read FLogger write SetLogger













Delphi xe10 static function in class