[fpc-pascal] Inherit interface from 2 interfaces
Zaher Dirkey
parmaja at gmail.com
Wed Apr 13 13:17:03 CEST 2011
On Tue, Apr 12, 2011 at 11:42 AM, <michael.vancanneyt at wisa.be> wrote:
>
>
> On Tue, 12 Apr 2011, Andreas Dorn wrote:
>
> On Fri, 8 Apr 2011,michael.vancanneyt worte:
>>
>>> The whole idea of interfaces is to avoid multiple inheritance.
>>>
>>> Hm. I don't believe that.
>>
>> One of the major points of interfaces is indeed to avoid the problems
>> of multiple class inheritance (diamond problems - i.e. problems caused by
>> conflicting implementations of a method in different ancestor classes).
>>
>> But Interfaces themselves don't have an implementation, so those
>> diamond problems simply don't exist for them.
>>
>
> Of course they do. If they inherit from 2 interfaces that have the same
> method with a different signature, you have a problem.
>
> InterfaceA = Interface
> Function IsValid : Integer;
> end;
>
> InterfaceB = Interface
> Function IsValid : String;
> end;
>
> How to define :
>
> InterfaceC = Interface(InterfaceA,InterfaceB)
>
>
I think, compile raise error duplicated methods, Same if inherit from one
and add a method already exists in parent interface.
Regards
--
Zaher Dirkey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20110413/f25b739c/attachment.html>
More information about the fpc-pascal
mailing list