<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Okay here is my second bit of confusion cleared up regarding interface
inheritance.<br>
If I declare the following types<br>
Type<br>
&nbsp; INoiseable = interface<br>
&nbsp;&nbsp;&nbsp; ['{B7A2C437-EC4C-485D-B7E2-CD085E8414BE}']<br>
&nbsp;&nbsp;&nbsp; procedure MakeNoise;<br>
&nbsp; end;<br>
&nbsp; ISpeakable = interface(INoiseable)<br>
&nbsp;&nbsp;&nbsp; ['{E789E48D-4105-4181-B644-96B94F27E48A}']<br>
&nbsp;&nbsp;&nbsp; procedure Speak;<br>
&nbsp; end;<br>
&nbsp; TPerson = class(TInterfacedObject, ISpeakable)<br>
&nbsp;&nbsp;&nbsp; procedure MakeNoise;<br>
&nbsp;&nbsp;&nbsp; procedure Speak;<br>
&nbsp; end;<br>
<br>
procedure TPerson.MakeNoise;<br>
begin<br>
&nbsp; showMessage('Some Noise');<br>
end;<br>
<br>
procedure TPerson.Speak;<br>
begin<br>
&nbsp; ShowMessage('Some Speach')<br>
end;<br>
<br>
procedure TForm4.Button1Click(Sender: TObject);<br>
var<br>
&nbsp; Person : TPerson;<br>
&nbsp; Speakable : ISpeakable;<br>
begin<br>
&nbsp; Speakable := TPerson.Create;<br>
&nbsp; (Speakable as INoiseable).MakeNoise; //this fails - TPerson does not
support INoiseable - eventhough it inherits from ISpeakable<br>
&nbsp; (Speakable as ISpeakable).MakeNoise; //this is fine<br>
end;<br>
<br>
However if I change my TPerson to the following<br>
&nbsp; TPerson = class(TInterfacedObject, ISpeakable, INoiseable)<br>
then all is happy.&nbsp; 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.<br>
<br>
<pre class="moz-signature" cols="72">Alister Christie
Computers for People
Ph: 04 471 1849 Fax: 04 471 1266
<a class="moz-txt-link-freetext" href="http://www.salespartner.co.nz">http://www.salespartner.co.nz</a>
PO Box 13085
Johnsonville
Wellington </pre>
<br>
<br>
Alister Christie wrote:
<blockquote cite="mid:489B7DA5.5080408@salespartner.co.nz" type="cite">
  <pre wrap="">No,

There is some other stuff that is confusing me also to do with interface 
inheritance - I think I'm going to have to do some reading.

Alister Christie
Computers for People
Ph: 04 471 1849 Fax: 04 471 1266
<a class="moz-txt-link-freetext" href="http://www.salespartner.co.nz">http://www.salespartner.co.nz</a>
PO Box 13085
Johnsonville
Wellington 



Todd Martin wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Hi Alister

Are you implementing IXMLResidentialType via delegation?

Todd.
  
    </pre>
    <blockquote type="cite">
      <pre wrap="">I'm having some fun with interfaces

I have two interfaces IXMLResidentialType and IAuctionable.
I have a class which implements these two interfaces
TXMLResidentialType = class(TXMLNode, IXMLResidentialType, IAuctionable) 
..

I have some code
var
  Res : IXMLResidentialType;
  Auctionable : IAuctionable;
begin
..
  if Res.QueryInterface(IAuctionable, Auctionable) = 0 then
    ShowMessage('Auctionable');

What I'm trying to determine is if Res implements IAuctionable - which 
it does (through TXMLResidentialType which effective Res is an instance 
of), however IXMLResidentialType doesn't seem to realise this.  How do I 
make this work?

Does this question make any sense?

If I'm not able to do this it's not too much of a problem, but will mean 
a bunch of duplicated code.


  
    
      </pre>
    </blockquote>
    <pre wrap="">_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: <a class="moz-txt-link-abbreviated" href="mailto:delphi@delphi.org.nz">delphi@delphi.org.nz</a>
Admin: <a class="moz-txt-link-freetext" href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</a>
Unsubscribe: send an email to <a class="moz-txt-link-abbreviated" href="mailto:delphi-request@delphi.org.nz">delphi-request@delphi.org.nz</a> with Subject: unsubscribe

  
    </pre>
  </blockquote>
  <pre wrap=""><!---->
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: <a class="moz-txt-link-abbreviated" href="mailto:delphi@delphi.org.nz">delphi@delphi.org.nz</a>
Admin: <a class="moz-txt-link-freetext" href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</a>
Unsubscribe: send an email to <a class="moz-txt-link-abbreviated" href="mailto:delphi-request@delphi.org.nz">delphi-request@delphi.org.nz</a> with Subject: unsubscribe

  </pre>
</blockquote>
</body>
</html>