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 IN
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, I
Okay here is my second bit of confusion cleared up regarding interface
inheritance.
If I declare the following types
Type
INoiseable = interface
['{B7A2C437-EC4C-485D-B7E2-CD085E8414BE}']
procedure MakeNoise;
end;
ISpeakable = interface(INoiseable)
['{E789E48D-4105-4181-B644-96B94F27E
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
http://www.salespartner.co.nz
PO Box 13085
Johnsonville
Wellington
Todd Martin wrote
Hi Alister
Are you implementing IXMLResidentialType via delegation?
Todd.
> 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, IAuct
Richard.Bullin
Web www.framecad.com
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Myles Penlington
Sent: Thursday, 7 August 2008 2:56 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Interfaces
Should work as is by the looks of it.
:47 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: [DUG] Interfaces
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, IXMLResidentia
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 : IAuc
Thanks. That confirms my own more recent thoughts on this.
Todd.
- Original Message -
From: "Dennis Chuah" <[EMAIL PROTECTED]>
To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
Sent: Wednesday, 29 January 2003 15:41
Subject: Re: [DUG]: Inter
.
- Original Message -
From: "Todd Martin" <[EMAIL PROTECTED]>
To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
Sent: Wednesday, January 29, 2003 11:11 AM
Subject: [DUG]: Interfaces without reference counting
> Hi. I'm trying to use interfaces in D
Hi. I'm trying to use interfaces in Delphi, but I want to disable
reference counting. So I created a new class (shown below) with a
method to free the object, but when I call ReleaseObject() I get an
access violation after "Free".
Anyone got any ideas about how I can free the interfaced object when
'lo - question on interfaces and reference counting/freeing.
I'm creatng an interface in Kylix, thats not descended from
TInterfacedObject, so I'm adding _Addref _Release and QueryInterface myself
(I'm descending from TPersistent), in _Addref and _Release I'm simply
returning 1, which I've see
ultiple recipients of list delphi" <[EMAIL PROTECTED]>
Sent: Thursday, August 08, 2002 1:11 PM
Subject: Re: [DUG]: Interfaces (and classes that support them)
> Phil,
> Thanks for the idea, but it kinda breaks the idea of an Interface being
> supported by *ANY* class typ
Hi Andrew et al,
At 21:11 15/06/01 , you wrote:
>I'm not sure if this functionality in D6, maybe someone could clarify, but
>in theory you should be able to drop a TEdit on a form, right click on it,
Danny Thorpe goes into some detail about new interface features in D6:
http://community.borland.
TECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Sandeep
Sent: Wednesday, 13 June 2001 10:27 a.m.
To: Multiple recipients of list delphi
Subject: [DUG]: Interfaces
Is there any advantage of using interfaces?
Sandeep
Software Developer
CFL
[EMAIL PROTECTED]
http:
At 17:02 13/06/01 , you wrote:
> function GetIterator: IIterator
>
>Auto gargage collection doesn't seem to me to summarize the significance
of this. You've
I don't think you can overstate the significance of garbage collection or
more generally, resource management. Its straightforward to clean
Peter,
I'm not sure what your question refers to, but if it's my suggestion that
try-finally is dead then it concerns a neat little trick I got from a presentation by
Malcolm
Groves at the last Borcon - his IRestore interface. You can get the details from
Malcolm's web site at
http://www.madriga
Don wrote:
> Auto gargage collection doesn't seem to me to summarize the
> significance of this. You've removed the whole try finally nonsense
> responsibility from the client. The client wants something, he just
> asks for it. Simple. It's possible that interfaces kill the
> try-finally construc
ke going from procedural to
> object oriented. :)
>
> Nahum.
>
> > -Original Message-
> > From: Sandeep [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, June 13, 2001 11:57 AM
> > To: Multiple recipients of list delphi
> > Subject: Re: [DUG]: Interfac
> If I have to redeclare all the methods in interface in the descended
> class then why not get rid of interface and I still have the same
> thing.
It's not the same thing.
Just because you have implemented methods Quack(), and Walk()
doesn't mean that a client application expecting to use yo
Sandeep asks:
> If I have to redeclare all the methods in interface in the descended
> class then why not get rid of interface and I still have the same
> thing. What's wrong with that?
Nothing, but if you want to have two seperate object hiearchies sharing the
same interface you only have two c
On 13 Jun 2001, at 14:53, Max Nilson wrote:
> Sandeep asks:
>
> > How do interfaces help i n multiple inheritence? If
> > I have a ClassA and ClassB then if I want to inherit ClassC from
> > ClassA its simple. But if I want to inherit from ClassA and ClassB
> > then using interface I have to imp
> Neven MacEwan quite correctly points out:
>
> > You can also delegate the inplemenation of an interface in delphi
>
> > ie
> >
> > TClassC - class(TClassA, InterfaceB)
> > private
> > FClassB: TClassB
> > property
> > InstClassB read FClassB write FClassB implements InterfaceB
> > end
>
> B
Neven MacEwan quite correctly points out:
> You can also delegate the inplemenation of an interface in delphi
> ie
>
> TClassC - class(TClassA, InterfaceB)
> private
> FClassB: TClassB
> property
> InstClassB read FClassB write FClassB implements InterfaceB
> end
But if you are doing any CO
D]>
Sent: Wednesday, 13 June 2001 14:19
Subject: Re: RE: [DUG]: Interfaces
> How do interfaces help i n multiple inheritence? If
> I have a ClassA and ClassB then if I want to inherit ClassC from
> ClassA its simple. But if I want to inherit from ClassA and ClassB
> then using int
Colin Fraser asked:
> Any disadvantages using Interfaces???
Not really. The main issue is designing your classes so that you can
actually take advantage of interfaces, rather than deep inheritance.
> Any slower performance???
No. Delphi interfaces are actually implemented as pointers to a part
Sandeep asks:
> How do interfaces help i n multiple inheritence? If
> I have a ClassA and ClassB then if I want to inherit ClassC from
> ClassA its simple. But if I want to inherit from ClassA and ClassB
> then using interface I have to implement all the functions in ClassB
> again in ClassC, so
How do interfaces help i n multiple inheritence? If
I have a ClassA and ClassB then if I want to inherit ClassC from
ClassA its simple. But if I want to inherit from ClassA and ClassB
then using interface I have to implement all the functions in ClassB
again in ClassC, so how does it makes li
Any disadvantages using Interfaces???
Any slower performance???
Anything to look out for???
Regards
Colin
##
Attention:
The information in this email and in any attachments is confidential.
If you are not the intended reci
> Ok, give a poor C++ programmer a hint... what are we talking about here?
>
interfaces are another way representing what "multiple inheritance"
(I think poorly) attempts to represent in C++
> Specifically, I've seen many definitions for 'interfaces', but none of
> them seems to quite fit the
Nic
> I design with them now - much easier, from my POV. They are used
> extensivly in Java as well, so its good practice if you are ever
> going to move.
Also good practive if your not, A lot of the OO Technology
is centred around the concept of interfaces (since I think multiple
inheritance
ha
ROTECTED]>
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 y
> Ok, give a poor C++ programmer a hint... what are we talking about here?
>
I think you lot call them "pure virtual classes" - ie a class with
no implementation. In Delphi, you can inherit from more than one of them,
which is a big advantage.
> Specifically, I've seen many definitions for '
Sandeep commented:
> Only one reply so far, so should I assume that there are not many
> people using Interfaces.
Interfaces are useful for a variety of things. In object oriented
programming terms that are used to implement the concept of generisity, and
this complements polymorphism and inheri
I design with them now - much easier, from my POV. They are used
extensivly in Java as well, so its good practice if you are ever
going to move.
Nic.
> On 13 Jun 2001, at 10:46, Neven MacEwan wrote:
>
> > Sandeep
> >
> > Simple Answer - HUGE
>
> Only one reply so far, so should I assume that
Nahum Wild <[EMAIL PROTECTED]> wrote on 13/06/2001 11:53:45:
>
>You can get around the auto garbage collection easily enough. Neven's
>simple answer is a good one. They have a huge impact on how you
>design apps etc... - for the better.
>
>Yes I use interfaces. Learning about them was a "oh, w
Reply Separator
Subject: Re: [DUG]: Interfaces
Author: [EMAIL PROTECTED]
Date: 13/06/2001 11:58
On 13 Jun 2001, at 10:46, Neven MacEwan wrote:
> Sandeep
>
> Simple Answer - HUGE
Only one reply so far, so should I as
perience, a bit like going from procedural to
object oriented. :)
Nahum.
> -Original Message-
> From: Sandeep [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 13, 2001 11:57 AM
> To: Multiple recipients of list delphi
> Subject: Re: [DUG]: Interfaces
>
>
> O
On 13 Jun 2001, at 10:46, Neven MacEwan wrote:
> Sandeep
>
> Simple Answer - HUGE
Only one reply so far, so should I assume that there are not many
people using Interfaces.
Sandeep
Software Developer
CFL
[EMAIL PROTECTED]
http://www.cfl.co.nz
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 Devel
Sandeep
Simple Answer - HUGE
Neven
- Original Message -
From: Sandeep <[EMAIL PROTECTED]>
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Sent: Wednesday, 13 June 2001 10:27
Subject: [DUG]: Interfaces
> Is there any advantage of using interfaces?
>
>
Is there any advantage of using interfaces?
Sandeep
Software Developer
CFL
[EMAIL PROTECTED]
http://www.cfl.co.nz
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://
f list delphi
Subject: Re: [DUG]: Interfaces Again ;)
>If you have done it right, there should not be a problem.
>In your example, when you create your delegation object -
>In your TMyOBject.Create you need to have a ._addref on
>your delegation object, ie >TMyOBject hold
>If you have done it right, there should not be a problem.
>In your example, when you create your delegation object -
>In your TMyOBject.Create you need to have a ._addref on
>your delegation object, ie >TMyOBject holds a reference to your object.
>
>When TMyObject is destroyed, in it's destructor
e recipients of list delphi
Subject: [DUG]: Interfaces Again ;)
I have a question regarding interface delegation and reference counting.
If a non interfaced object is extended with an interface and that interface uses
delegation to implement that interface then how is instance destruction
I have a question regarding interface delegation and reference counting.
If a non interfaced object is extended with an interface and that interface uses
delegation to implement that interface then how is instance destruction detected
by the delegating class. Example below
if the following is do
46 matches
Mail list logo