More importantly, the code you gave would probably not do what (I think) you want it to do even if the inherited *did* do what you wanted it to do.
If you were trying to call the SetFilter and SetFiltered methods on the inherited class then that code wouldn't work. Assuming that the SetFilter method and the GetFiltered method are virtual and overriden in the calling routine, then the call to Result.Filter would still call your overriden method. Same for Result.Filtered. That sounds more complicated than I meant it to. What I mean is that polymorphism would prevent that code from doing what I think you want it to do. regards, Phil. ----- Original Message ----- From: "Andreas Toth" <[EMAIL PROTECTED]> To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]> Sent: Wednesday, August 21, 2002 3:09 PM 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/