If I have TPerson = class(TInterfacedObject, ISpeakable).... Procedure MakeANoise(n : INoiseable); begin n.MakeNoise; end;
and var Person : TPerson; begin Person := TPerson.Create; MakeANoise(Person); //Incompatible types: 'INoiseable' and 'TPerson' end; I can't pass a TPerson to an INoiseable, unless I add INoisable to its class definition. Supporting ISpeakable does not make it support INoisable (annoyingly - and I don't yet understand why not). The background to what I'm trying to do is process an xml file (lots of them really). I have generated a bunch of code (about 7k lines, involving over 80 interfaces and as many classes) using the XML databinding wizard (from a DTD), but there is a significant amount of overlap between many of the objects (and interfaces). So I have been trying to clean up the interfaces so that when I process the files I can reduce the amount of duplicate code. It's taking a lot longer that it should as my understanding of interfaces is limited (although I'm slowly getting there). I'd probably be finished by now if I just did a lot of copy & paste - but that would be wrong ;-) Anyway - I'll keep persisting. Alister Christie Computers for People Ph: 04 471 1849 Fax: 04 471 1266 http://www.salespartner.co.nz PO Box 13085 Johnsonville Wellington Todd Martin wrote: > That is exactly right, but why would you want to, when ISpeakable > supports makeNoise() anyway? > You can still pass your TPerson object into a method(AObject : > INoiseable) without problems. > > Todd. > >> However if I change my TPerson to the following >> TPerson = class(TInterfacedObject, ISpeakable, INoiseable) >> then all is happy. I don't quite understand fully why as yet - I >> guess you can't get an interface pointer to an object unless it >> explicitly states that it supports that interface. >> > _______________________________________________ > NZ Borland Developers Group - Delphi mailing list > Post: delphi@delphi.org.nz > Admin: http://delphi.org.nz/mailman/listinfo/delphi > Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe > > _______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: delphi@delphi.org.nz Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe