I forgot to state that if I add the name of the function after inherited it
works, but why?


-Andreas

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Andreas Toth
Sent: Wednesday, 21 August 2002 15:10
To: Multiple recipients of list delphi
Subject: [DUG]: Overriding and Inheriting Function Methods


When I try to compile the following the compiler returns the error
"incompatible types":

  Result := inherited; // or simply: inherited;

For your information, I wanted to follow the above with:

  Result.Filter   := GetFilter;
  Result.Filtered := Result.Filter <> '';

Oh, and if you haven't already guessed it, the method that I'm overriding is
a function returning a TDataSet.

To get around this I thought that I could simply call inherited on its own,
but even that generates the same error.

OK, so I'm not completely lost as why I get this error since I would say
that inherited **always** behaves like a procedure-like call and as such
doesn't (sadly) return a type.

Any suggestions to why this is and/or solutions around it? By the way,
rewriting the function as a procedure with a var parameter is (I reckon)
ugly as since it doesn't clearly define who is responsible for creating the
object.


-Andreas

---------------------------------------------------------------------------
    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/

---------------------------------------------------------------------------
    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