BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Interface inheritance

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OO design
View previous topic :: View next topic  
Author Message
Soeren Muehlbauer
Guest





PostPosted: Wed Dec 22, 2004 12:03 pm    Post subject: Interface inheritance Reply with quote



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





PostPosted: Wed Dec 22, 2004 12:22 pm    Post subject: Re: Interface inheritance Reply with quote




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





PostPosted: Wed Dec 22, 2004 12:31 pm    Post subject: Re: Interface inheritance Reply with quote



"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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OO design All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.