You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Seema Makkar <se...@aricent.com> on 2013/10/30 10:49:49 UTC
Issues in Type casting
Hello all ,
I have created customize class that extends Arraycollection
For eg
Public class PagingArrayCollection extends Arraycollection
Now I have to cast ArrayCollection to PagingArrayCollection.
Suppose
Var arr: ArrayCollection = new ArrayCollection();
Var lst: PagingArrayCollection= new PagingArrayCollection();
Lst= arr;
But it is giving Implict coercion
If I will typecast
Lst= arr as PagingArrayCollection;
Then it is returning null values.
How can we type cast?
Please suggest.
Thanks,
Seema
===============================================================================
Please refer to http://www.aricent.com/legal/email_disclaimer.html
for important disclosures regarding this electronic communication.
===============================================================================
Re: Issues in Type casting
Posted by 峰郭 <hy...@gmail.com>.
"arr" is an instance of "ArrayCollection", not an instance of "
PagingArrayCollection"
On 30 October 2013 17:49, Seema Makkar <se...@aricent.com> wrote:
> Hello all ,
>
> I have created customize class that extends Arraycollection
> For eg
>
> Public class PagingArrayCollection extends Arraycollection
>
> Now I have to cast ArrayCollection to PagingArrayCollection.
> Suppose
> Var arr: ArrayCollection = new ArrayCollection();
> Var lst: PagingArrayCollection= new PagingArrayCollection();
>
> Lst= arr;
>
>
> But it is giving Implict coercion
>
> If I will typecast
> Lst= arr as PagingArrayCollection;
>
> Then it is returning null values.
>
> How can we type cast?
> Please suggest.
>
>
> Thanks,
> Seema
>
>
>
>
>
>
>
>
>
> ===============================================================================
> Please refer to http://www.aricent.com/legal/email_disclaimer.html
> for important disclosures regarding this electronic communication.
>
> ===============================================================================
>
RE: Issues in Type casting
Posted by Maurice Amsellem <ma...@systar.com>.
You can cast a sub class to its super class, not the opposite
Maurice
-----Message d'origine-----
De : Seema Makkar [mailto:seema.makkar@aricent.com]
Envoyé : mercredi 30 octobre 2013 10:50
À : dev@flex.apache.org
Objet : Issues in Type casting
Hello all ,
I have created customize class that extends Arraycollection For eg
Public class PagingArrayCollection extends Arraycollection
Now I have to cast ArrayCollection to PagingArrayCollection.
Suppose
Var arr: ArrayCollection = new ArrayCollection(); Var lst: PagingArrayCollection= new PagingArrayCollection();
Lst= arr;
But it is giving Implict coercion
If I will typecast
Lst= arr as PagingArrayCollection;
Then it is returning null values.
How can we type cast?
Please suggest.
Thanks,
Seema
===============================================================================
Please refer to http://www.aricent.com/legal/email_disclaimer.html
for important disclosures regarding this electronic communication.
===============================================================================