Andreas I've found similar inconsistencies, if overriding a procedure then
procedure MyClass.Method(var I: integer); begin inherited; // inherited Method(I) <- this is equiv end; else if overriding a function then function MyClass.Foo: boolean; begin Result := inherited Foo; // Result := inherited; // does not work, incompatible types end; Seems silly that the compiler can resolve a procedure but not a function the avantage of using inherited on its own is that if you cange the signature you don't have to change the inherited call Neven ----- 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/