Re: In which packages can an interface be extended?

Daniel Bonniot <[email protected]> Wed, 25 Feb 2004 10:27:08 +0100
Newsgroups gmane.comp.lang.nice.general
Message-ID <[email protected]>
Isaac Gouy wrote:

>Seems like an interface can only be extended in the package where it
>was declared - is that correct?
>  
>
I think the usual meaning for "an interface is extended" is "a new 
interface that extends the original one is declared", but it doesn't 
seem that's what you mean.

>//---
>package main;
>public interface ITest {}
>
>//---
>package vendor;
>public interface IVendor {}
>
>//---
>package test;
>import main;
>import vendor;
>interface main.ITest implements vendor.IVendor;
>  
>
So what you want is to have two independent interfaces, and in a third 
package declare than actually one implements the other, right? Do you 
have a canonical example where this is useful?

This is not supported at the moment. You can do "after declaration" 
implementations of abstract interfaces (and there is an abstract 
interface hiding behing a normal one :-), but there are some 
restrictions. Those restrictions are actually not the right ones, but 
this did not seem to be a priority to work on that.

>This works fine:
>   package vendor;
>   import main;
>   interface main.ITest implements IVendor;
>  
>
Yes, that's aking to implementing abstract interfaces.

Daniel



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click