Yes, that's indeed one way to do it, but it does not solve the problem. Imagine 
that we have something like the following example (which is exactly what's 
happening in my case):

var b:InterfaceB = this.call.something.thatReturnsAsAnInterfaceB();
b.data = "something";

In this case I cannot assume that the returned instance is from a specific 
implementation (like 'ImplementationClass'), that's the all point of using 
interfaces :P 
Any other ideas?

Bruno Leite

--- In [email protected], "valdhor" <valdhorli...@...> wrote:
>
> Shouldn't it be...
> 
> var impl1:ImplementationClass = new ImplementationClass();
> var implA:InterfaceA = InterfaceA(impl1);
> 
> impl1.data = "Something";
> trace(implA.data);
> 
> 
> --- In [email protected], "bmsleite" <bmsleite@> wrote:
> >
> > Hi everyone,
> >
> > I hope you guys can help me out with this doubt regarding interfaces
> that extends from other interfaces.
> >
> > The scenario is the following:
> >
> > ImplementationClass -implements-> InterfaceB -extends-> InterfaceA
> >
> > A code example:
> >
> > public interface InterfaceA
> > {
> >    function get data():*;
> > }
> >
> >
> > public interface InterfaceB extends InterfaceA
> > {
> >    function set data(value:*):void;
> > }
> >
> >
> > public class ImplementationClass implements InterfaceB
> > {
> >    private var _data:*;
> >
> >    public function Implementation(){}
> >
> >    public function set data(value:*):void
> >    {
> >        _data = data;
> >    }
> >
> >    public function get data():*
> >    {
> >        return _data;
> >    }
> >
> > }
> >
> > Now, the question is, is this possible? If I write something like
> this:
> >
> > var impl:InterfaceB = new ImplementationClass();
> > impl.data = "something";
> >
> > Should this be possible? Well, possible I know that it isn't because
> this gives me an "Ambigous reference to data" error, but isn't this a
> logical implementation, am I missing something here?
> >
> > Probably the cause for this behaviour has to do with the way that
> getters and setters are implemented in AS3, if that's the case, can
> anyone explain me, or give me some ideas how this works internally?
> >
> > Thank you for your time.
> >
> > Bruno Leite
> >
>


Reply via email to