Hi Guys. Thanks for all the feedback. I didn't realise it would get so much response. In the end I decided to go with the following : IFirstDescendant = interface(IInterface); ISecondDescendant = interface(IFirstDescendant);
TNewClass = class(TInterfacedObject,IFirstDescendant ,ISecondDescendant); However I noticed one very peculiar aspect of interfaces along the way when compiling. If I define a procedure DoSomething(AObject : IFirstDescendant); and TNewClass = class(TInterfacedObject,ISecondDescendant); and then the following code compiles okay procedure Test; var MyObject : ISecondDescendant; begin MyObject := TNewClass.Create; DoSomething(MyObject); end; I haven't checked yet, but I'm assuming the MyObject passed through to procedure DoSomething() is then "nil", since TNewClass doesn't support IFirstDescendant. Would that be your guess too? So why does it compile? On the otherhand, does the ISecondDescendant pointer get sucessfully converted to a IFirstDescendant pointer, in which case, why does MyObject.QueryInterface(IFirstDescendant,FirstObject) return a "nil" pointer to FirstObject? However, if I define IFirstDescendant = interface(IInterface); ISecondDescendant = interface(IInterface); ie. no interface inheritance - (or whatever you want to call it) and TNewClass = class(TInterfacedObject,IFirstDescendant,ISecondDescendant); the Test() procedure does not compile. Any comments? Thanks. ----- Original Message ----- From: "Conor Boyd" <[EMAIL PROTECTED]> To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]> Sent: Monday, June 16, 2003 10:31 AM Subject: RE: [DUG]: Interface Inheritance > There are a lot of people (including me) who never use the term 'interface > inheritance'. You're right, it's not inheritance. > > As an aside, having had the 'chance' recently to go some VB6 coding :-( I > found the Microsoft documentation utterly misleading when it talks about > interface inheritance, when IMO it should be talking about 'interface > implementation', which is probably a phrase which is also appropriate to > what we're talking about here. > > Cheers, > > Conor > > -----Original Message----- > From: Karl Reynolds [mailto:[EMAIL PROTECTED] > > > So this is one simple case where you have IStream inheriting > > from ISequentialStream (see ActiveX.pas) but you are not required > > to implement ISequentialStream is you are implementing IStream. > > Utterly bizarre. I get your point - that interface "inheritance" has to be > implemented the way it is in Delphi in order to support such strangeness. > But it's not really inheritance any more, is it. > -------------------------------------------------------------------------- - > 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/
