You cannot overload a function based on the function result alone.  This
because the compiler allows you to call the function without having to
assign the result to a variable.  Even if it forces you to do so, allowing
overloading on function result is difficult at best, eg. if you have one
function returning a string and another returning a pointer.  If you call
the string function and cast the result as a PChar, how should the compiler
interpret that?  Should it call the function that returns the pointer, or
should it call the function that returns a string and then cast it to a
PChar?

Regards,
Dennis.

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, 26 September 2001 14:23
> To: Multiple recipients of list delphi
> Subject: RE: [DUG]: Interesting Delphi 5 compiler bug
>
>
> Thankfully,
> The method overloading in D6 is much better (eg Strings and WideString
> method overloads now work). I think the function result is still
> not checked
> in D6.
> Myles.
>
>
> -----Original Message-----
> From: Dennis Chuah [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, 26 September 2001 1:39 p.m.
> To: Multiple recipients of list delphi
> Subject: [DUG]: Interesting Delphi 5 compiler bug
>
>
>
> The following compiles with an error in D5.
>
> type
>   TSomeObject = class
>   private
>     procedure GetA (msg: TMessage); overload; message 1;
>     function GetA: Integer; overload;
>   public
>     property A: Integer read GetA;
>   end;
>
> It seems like D5's compiler is not able to correctly resolve the
> overloaded
> property access method.
>
> Regards,
> Dennis.

---------------------------------------------------------------------------
    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"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to