Sandeep

Firstly separate the concept of Interfaces from the COM et al implementation
(that uses interfaces) and does reference counting etc (ie your comments re
garbage collection)

Interfaces address the major limitation of the single inheritance model, ie
polymorhism. The
are simply a structured method is refencing an object in various ways

ie.

TMyClass = Class(TClass, IMyInterface1, IMyInterface2..)

means you can reference an instance of TMyClass  as any of

1/ An instance of TMyClass (or its SuperClasses)
2/ An instance of IMyInterface1
3/ An instance of IMyInterface2...

If you look at how Delphi implements an InplaceEdit or a Collection it gives
you an idea of the limitations of single inheritance.
in the case of an InplaceEdit, it may have a lot in common with an existing
TEdit but you can't inherit from it (we could do
a discussion on 'Wrappper Design Pattens' here...). I was disappointed that
the CLX didn't take to oppourtunity to clean this up and
define an IInplaceEdit (Delphi because of history seems to be ho hum on
interfaces in the Component Lib). Similary for collections
the collection inherits from TCollection and the Item from TCollectionItem
(again an ICollectionItem would make this easy for
example to have a collection of existing classes (and mixed class objects!)

Get the idea, if you want to give some commonality to a set of classes,
define an interface

HTH

Neven




----- Original Message -----
From: Sandeep <[EMAIL PROTECTED]>
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Sent: Wednesday, 13 June 2001 11:56
Subject: Re: [DUG]: Interfaces


> On 13 Jun 2001, at 10:46, Neven MacEwan wrote:
>
> > Sandeep
> >
> > Simple Answer - HUGE
>
> I haven't used them yet. And if it is used for automatic garbage
> cleaning (I think I'm right here) then it may not be a good
> programming practice, or it may be a lazy way of programming.
>
> Sandeep
>
> Software Developer
> CFL
> [EMAIL PROTECTED]
> http://www.cfl.co.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"
>

---------------------------------------------------------------------------
    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"

Reply via email to