 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Soeren Muehlbauer Guest
|
Posted: Wed Dec 22, 2004 12:03 pm Post subject: Interface inheritance |
|
|
Hi,
i have some problems with interface inheritance.
I1 = interface
['{213DCE3C-D409-4B9A-9522-725202010A31}']
procedure A;
end;
I2 = interface(I1)
['{78AC955D-5C2B-4683-A000-D6C5AED57F56}']
procedure B;
end;
TTest = class(TInterfacedObject, I1, I2)
private
F1: I1;
public
procedure B;
property Intf1: I1 read F1 implements I1;
end;
The code won't compile, because the compiler thinks procedure A needs to
be declared. Why?
Thanks, Soeren
|
|
| Back to top |
|
 |
Franz-Leo Chomse Guest
|
Posted: Wed Dec 22, 2004 12:22 pm Post subject: Re: Interface inheritance |
|
|
| Quote: | The code won't compile, because the compiler thinks procedure A needs to
be declared. Why?
|
It looks for procedure A which is part of Interface I2. Only a
normally defined interface member can be shared between interfaces.
Regards from Germany
Franz-Leo
|
|
| Back to top |
|
 |
Joanna Carter (TeamB) Guest
|
Posted: Wed Dec 22, 2004 12:31 pm Post subject: Re: Interface inheritance |
|
|
"Soeren Muehlbauer" <soeren.dd (AT) gmx (DOT) de> a écrit dans le message de news:
41c962cd$1 (AT) newsgroups (DOT) borland.com...
| Quote: | i have some problems with interface inheritance.
I1 = interface
['{213DCE3C-D409-4B9A-9522-725202010A31}']
procedure A;
end;
I2 = interface(I1)
['{78AC955D-5C2B-4683-A000-D6C5AED57F56}']
procedure B;
end;
TTest = class(TInterfacedObject, I1, I2)
private
F1: I1;
public
procedure B;
property Intf1: I1 read F1 implements I1;
end;
The code won't compile, because the compiler thinks procedure A needs to
be declared. Why?
|
Because you are trying to split an interface into its constituent parts. I2
is regarded as one interface and has to be completely implemented, either by
the class or by a delegate.
Do you really need to inherit I1 ? removing the inheritance achieves what
you are trying to do.
Joanna
--
Joanna Carter (TeamB)
Consultant Software Engineer
TeamBUG support for UK-BUG
TeamMM support for ModelMaker
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|