Difference between revisions of "Class constants"

From Lazarus wiki
Jump to navigationJump to search
m (correct syntax error)
 
Line 21: Line 21:
 
[[Category:FPC]]
 
[[Category:FPC]]
 
[[Category:Constants]]
 
[[Category:Constants]]
 +
[[Category:Code]]

Latest revision as of 03:03, 13 February 2018

FP supports typed class constants, if the compiler-switch {$static on} is set. There are no untyped class constants.

type
	TCars = class(TVehicles)
		private
		public
			wheelcount: integer; static;
	end;

begin
	TCars.wheelcount := 4;
	// further assignments are forbidden
end.

Weblinks