> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:delphi-
> [EMAIL PROTECTED] On Behalf Of Neven MacEwan
> Sent: Friday, 4 May 2007 2:45 p.m.
> To: NZ Borland Developers Group - Delphi List
> Subject: Re: [DUG] Dumb Friday Question
>
> You guys don't consider a constructor a function then?
>
> I think its totally stylistic, if you want to have functions returning
> objects fine, just make it plain that they do,
>
> IMHO
>

The whole point of the 'pass in the complex object' convention is to make it 
obvious who the object owner is.  That is not a problem with a constructor.

In this case, Delphi convention is to pass in the object.

If you are passing around your own objects, you can also solve the problem by 
using an interface

Function GetMyObject: IMyObject;
Begin
  Result:= TMyObject.Create;
...
End;

Interfaces are reference counted and will be freed when ref count = 0.


Regards

Sean Cross
IT Systems Development Manager

Catalyst Risk Management
PO Box 230
50 Dalton St
Napier 4140
DDI: 06-8340362
mobile: 021 270 3466
Visit us at http://www.catalystrisk.co.nz/

Offices in Auckland, Napier, Wellington & Christchurch

Disclaimer:
"The information contained in this document is confidential to the addressee(s) 
and may be legally privileged. Any view or opinions expressed are those of the 
author and may not be those of Catalyst Risk Management. No guarantee or 
representation is made that this communication is free of errors, viruses or 
interference. If you have received this e-mail message in error please delete 
it and notify me. Thank you."

_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe

Reply via email to