> You missed the 'class' part of the class procedure, it should be as below
> with the class reference at the very begining of the statement. Good idea
> though, you get rid of the object trying to free itself within its own
> constructor which sounds a bit dodgy. :)
> class procedure TMyGadget.CreateBriefly;
> var it:TMyGadget;
> begin
> it:=nil;
> try
> it:=TMyGadget.Create(); //call the protected constructor
> finally
> it.free;
> end;
> end;
The downside is that the 'protected' feature isn't possible as create is public in
TObject.
Means that an outsider using your class can still unknowingly do a TMyGadet.Create even
if they're not a descendant.
--
Aaron Scott-Boddendijk
INTAZ Limited
+64 7 838 3371 Voice
+64 7 838 3372 Fax
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"