An Interface is an Interface is an Interface is an Interface.

Really, there is no such thing as Interface Inheritance.

An object either implements an Inteface or it does not. End of story.

Something like
IMyStuff = interface(IDispatch)
...
end;

Is not actually inheritance. Technically this says when you implement
IMyStuff you also have to implement the functionality as required/defined by
IDispatch. This does not mean your object also implements IDispatch, but
obviously if you implement those methods you can also support IDispatch if
you need too.

Object inhertance is about strong coupling. The whole concept of Interfaces
is about loose/weak coupling.

Ie. I agree with Max.

Waiting for bullets to fly :-)

Myles.


-----Original Message-----
From: Max Nilson [mailto:[EMAIL PROTECTED]
Sent: Monday, 16 June 2003 09:49
To: Multiple recipients of list delphi
Subject: RE: [DUG]: Interface Inheritance


Karl Reynolds asked me:

> Hmmm.  I'd like to hear of a situation where you wouldn't want an ancestor
> interface to be available where the descendant is.

OK, one example I foiund within two minutes of looking into the MSDN is the
follwing quote directly from Microsoft:
(ms-help://MS.MSDNQTR.2003APR.1033/wcedcom/htm/cerefISequentialStreamIUnknow
n.htm)

-----------------------------

You can implement ISequentialStream on an object if you require simple
sequential access to a stream object. If you implement IStream, you must
provide an implementation of the Read and Write methods from
ISequentialStream.

Note:  Most applications do not implement ISequentialStream as a separate
interface, and you are not required to provide it separately even if you
provide an IStream implementation. For example, the compound file
implementation of structured storage does not succeed on a QueryInterface
method for ISequentialStream but it includes the Read and Write methods
through the IStream interface pointer.

----------------------------

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.

And if it was this easy to find one simple example I suspect that there are
a lot of other cases where Microsoft is building interfaces up out of more
basic and general interface specifications that are need not be implemented
by themselves.

> I think it was a mistake of Borland not to include ancestor
> interfaces automatically.

I'm going to stick to my opinion that explicit declarations of interface
support provide much more safety and obvious programming behaviour, than
unexpected implicit interface being provided on your class.

Cheers, Max.
---------------------------------------------------------------------------
    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/

Reply via email to