[fpc-pascal] Is it posible to implement more than one interface in a class defination?

2010-11-14 Thread yu ping
For example if there are two Interface : IinterfaceA,IinterfaceB can I implement these two interface in one class? Thanks pingyu ___ fpc-pascal maillist -

Re: [fpc-pascal] Is it posible to implement more than one interface in a class defination?

2010-11-14 Thread Sven Barth
On 14.11.2010 13:08, yu ping wrote: For example if there are two Interface : IinterfaceA,IinterfaceB can I implement these two interface in one class? Yes, you can. Take the following example: type IInterfaceA = interface procedure A; end; IInterfaceB = interface procedure

Re: [fpc-pascal] Is it posible to implement more than one interface in a class defination?

2010-11-14 Thread Graeme Geldenhuys
On 14 November 2010 14:08, yu ping wrote:  For example if there are two Interface : IinterfaceA,IinterfaceB  can I implement these two interface in one class? Yes you can, but be warned, Interfaces doesn't seem to be a high priority feature in FPC - I don't think many here use Interfaces. There

Re: [fpc-pascal] Is it posible to implement more than one interface in a class defination?

2010-11-14 Thread Graeme Geldenhuys
Hi Everybody, On 14 November 2010 16:31, Jonas Maebe wrote: Please don't spread FUD. There are several projects that make heavy use of interfaces that work fine with FPC (e.g. Zeoslib). Yes, interface delegation is not finished (other than that, interfaces work fine afaik) Let me just

Re: [fpc-pascal] Is it posible to implement more than one interface in a class defination?

2010-11-14 Thread Sven Barth
On 14.11.2010 17:49, Graeme Geldenhuys wrote: * incomplete delegation (non existent in FPC 2.4.2) I haven't used this for quite a long time, so I can't test it just now... what are you missing? * No name resolution (function aliases) of conflicting interfaces Ehhh... the

Re: [fpc-pascal] Is it posible to implement more than one interface in a class defination?

2010-11-14 Thread Florian Klaempfl
Sven Barth schrieb: * No name resolution (function aliases) of conflicting interfaces Ehhh... the following code compiles with 2.4.2 and even 2.4.0: Typical FUD tactics: mix something people know being true with something wrong and they believe you the wrong statement. var t:

Re: [fpc-pascal] Is it posible to implement more than one interface in a class defination?

2010-11-14 Thread Sven Barth
On 14.11.2010 18:17, Florian Klaempfl wrote: var t: TMyInterfacedObject; i: IMyInterface; begin t := TMyInterfacedObject.Create; try i := t; t.Foo; i.Foo; finally t.Free; end; end. source end Output is: output begin Foo Bar An unhandled exception occurred at $08056B71 :

Re: [fpc-pascal] Is it posible to implement more than one interface in a class defination?

2010-11-14 Thread Graeme Geldenhuys
On 14 November 2010 19:11, Sven Barth pascaldra...@googlemail.com wrote:    * No name resolution (function aliases) of conflicting interfaces Ehhh... the following code compiles with 2.4.2 and even 2.4.0: My apologies then, I must not have seen the announcement. I also looked in my ref.pdf

Re: [fpc-pascal] Is it posible to implement more than one interface in a class defination?

2010-11-14 Thread Andrew Hall
I suspect the reason is that the object still has a refCount of 1 when you free it and this code raises the exception: procedure TInterfacedObject.BeforeDestruction; begin if frefcount0 then HandleError(204); end; You should never free an interfaced object

Re: [fpc-pascal] Is it posible to implement more than one interface in a class defination?

2010-11-14 Thread Andrew Hall
FWIW, both interface delegation (implements) and method aliasing have been supported in FPC for at least 2 years (we first tested/used them in January 2009 with FPC 2.2.2 which was released in August 2008). * We have used method aliasing extensively - it appears to behave the same as