[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] |
Fail a constructor
Source position: system.fpd line 94
procedure Fail; |
Fail can be used in a constructor for an object or class. It will exit the constructor at once, and the memory allocated for the constructor is freed. This mean that for objects allocated with New, the resulting pointer is Nil and for classes, the object instance will be Nil.
|
Return pointer to VMT of an object |
|
|
Dynamically allocate memory for variable |
|
|
Initialize memory block using RTTI |
|
|
Finalize (clean up) memory block using RTTI |
program testfail; {$mode objfpc} Type TMyClass = Class Constructor Create; end; Constructor TMyClass.Create; begin Fail; end; var M : TMyClass; begin M:=TMyClass.Create; Writeln('M is nil : ',Not Assigned(M)); end.