Difference between revisions of "Class constants"

From Lazarus wiki
Jump to navigationJump to search
m (syntaxhighlight, update link to documentation)
m (correct syntax error)
Line 7: Line 7:
 
private
 
private
 
public
 
public
wheelcount: integer: static;
+
wheelcount: integer; static;
 
end;
 
end;
  

Revision as of 18:19, 11 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