[fpc-pascal] Question about interfaces and patch

Michael Van Canneyt michael.vancanneyt at wisa.be
Wed Mar 23 16:22:09 CET 2005



On Wed, 23 Mar 2005 ml at brainwashers.org wrote:

> Quoting Marco van de Voort <marcov at stack.nl>:
>
>>> On Tue, 22 Mar 2005, ml wrote:
>>>> // than one interface
>>>>  a := (object as IA); // correct
>>>>  b := (object as IB); // returns pointer to the first interface
> vmt=IA
>>>>  c := (object as IC); // returns pointer to the first interface
> vmt=IA
>>>> // there's no way to do again it's like direct call to exception
>>>>  obj := a; // returns pointer(obj) + 12 ???
>>>
>>> This is nonsense. You cannot assign an interface to a class.
>>> A class IMPLEMENTS an interface, it is not an interface.
>
> Ok, its nonsense. I said it already works with my patch, but I guess you
> know it better. So my example down there doesn't work (with patch). You
> should know.
> I (; can't ;) transfer from one interface to other back to object and to
> 3rd interface. I just imagine my results.

Tell me, what is

   obj := a;

supposed to DO ? A class has a set of methods. Some of these methods form
the VMT of an interface. What your code does, is say
"don't use your VMT methods, use these instead' ?

Michael.




More information about the fpc-pascal mailing list