You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Erik de Bruin <er...@ixsoftware.nl> on 2013/11/14 17:58:29 UTC

[FLEXJS] inheritance/interfaces

Hi,

Quick question (too lazy to build an AS project to check):

If class B extends class A and class A implements interface IA, does
class B also implement IA? In other words, in this scenario, does (B
is IA) return true?

I'm asking, because org.apache.flex.utils.Language.is() currently
doesn't. If it should, that'll be my first thing... and I was sooo
close to solving the CSS thing ;-)

Thanks,

EdB



-- 
Ix Multimedia Software

Jan Luykenstraat 27
3521 VB Utrecht

T. 06-51952295
I. www.ixsoftware.nl

AW: [FLEXJS] inheritance/interfaces

Posted by "christofer.dutz@c-ware.de" <ch...@c-ware.de>.
It's acutally pretty important that B also implements IA ... so an "instanceof" or "is" check should work as well as it should be possible to cast instaces A and B to IA.

Chris

________________________________________
Von: Erik de Bruin [erik@ixsoftware.nl]
Gesendet: Donnerstag, 14. November 2013 17:58
An: dev@flex.apache.org
Betreff: [FLEXJS] inheritance/interfaces

Hi,

Quick question (too lazy to build an AS project to check):

If class B extends class A and class A implements interface IA, does
class B also implement IA? In other words, in this scenario, does (B
is IA) return true?

I'm asking, because org.apache.flex.utils.Language.is() currently
doesn't. If it should, that'll be my first thing... and I was sooo
close to solving the CSS thing ;-)

Thanks,

EdB



--
Ix Multimedia Software

Jan Luykenstraat 27
3521 VB Utrecht

T. 06-51952295
I. www.ixsoftware.nl

Re: [FLEXJS] inheritance/interfaces

Posted by Erik de Bruin <er...@ixsoftware.nl>.
> As far as I know, "instanceof" checks do *not* work with interfaces. That's
> what "is" is for. "is" works for both classes and interfaces.

Correct.

I've updated the 'org.apache.flex.utils.Language.is()' method to take
super class interface implementation into account. I also updated the
example 'LanguageTests' with more checks.

EdB



-- 
Ix Multimedia Software

Jan Luykenstraat 27
3521 VB Utrecht

T. 06-51952295
I. www.ixsoftware.nl

Re: [FLEXJS] inheritance/interfaces

Posted by Frank Wienberg <fr...@jangaroo.net>.
As far as I know, "instanceof" checks do *not* work with interfaces. That's
what "is" is for. "is" works for both classes and interfaces.

new B() instanceof A => true
new B() instanceof IA => false (or even compile error?)
new B() is A => true
new B() is IA => true


On Thu, Nov 14, 2013 at 7:18 PM, OmPrakash Muppirala
<bi...@gmail.com>wrote:

> This might be related to [1] as well.
>
> Thanks,
> Om
>
> [1] https://issues.apache.org/jira/browse/FLEX-33780
>
>
> On Thu, Nov 14, 2013 at 9:39 AM, Erik de Bruin <er...@ixsoftware.nl> wrote:
>
> > Thanks. On it.
> >
> > EdB
> >
> >
> >
> > On Thu, Nov 14, 2013 at 6:37 PM, Michael A. Labriola
> > <la...@digitalprimates.net> wrote:
> > >>If class B extends class A and class A implements interface IA, does
> > class B also implement IA? In other words, in this scenario, does (B is
> IA)
> > return true?
> > >
> > > Yep
> > >
> > >
> >
> >
> >
> > --
> > Ix Multimedia Software
> >
> > Jan Luykenstraat 27
> > 3521 VB Utrecht
> >
> > T. 06-51952295
> > I. www.ixsoftware.nl
> >
>

Re: [FLEXJS] inheritance/interfaces

Posted by OmPrakash Muppirala <bi...@gmail.com>.
This might be related to [1] as well.

Thanks,
Om

[1] https://issues.apache.org/jira/browse/FLEX-33780


On Thu, Nov 14, 2013 at 9:39 AM, Erik de Bruin <er...@ixsoftware.nl> wrote:

> Thanks. On it.
>
> EdB
>
>
>
> On Thu, Nov 14, 2013 at 6:37 PM, Michael A. Labriola
> <la...@digitalprimates.net> wrote:
> >>If class B extends class A and class A implements interface IA, does
> class B also implement IA? In other words, in this scenario, does (B is IA)
> return true?
> >
> > Yep
> >
> >
>
>
>
> --
> Ix Multimedia Software
>
> Jan Luykenstraat 27
> 3521 VB Utrecht
>
> T. 06-51952295
> I. www.ixsoftware.nl
>

Re: [FLEXJS] inheritance/interfaces

Posted by Erik de Bruin <er...@ixsoftware.nl>.
Thanks. On it.

EdB



On Thu, Nov 14, 2013 at 6:37 PM, Michael A. Labriola
<la...@digitalprimates.net> wrote:
>>If class B extends class A and class A implements interface IA, does class B also implement IA? In other words, in this scenario, does (B is IA) return true?
>
> Yep
>
>



-- 
Ix Multimedia Software

Jan Luykenstraat 27
3521 VB Utrecht

T. 06-51952295
I. www.ixsoftware.nl

RE: [FLEXJS] inheritance/interfaces

Posted by "Michael A. Labriola" <la...@digitalprimates.net>.
>If class B extends class A and class A implements interface IA, does class B also implement IA? In other words, in this scenario, does (B is IA) return true?

Yep