If I am a subclass of an Array, how do I access an element?
class ArrayOfFoo extends Array
{
public function getFooAt(anIndex : int) : Foo
{
return this[anIndex] as Foo; // <---- looks for an object attribute (named "0", for example)
}
}
I could wrap an array instead of subclassing it, however lacking a universal IArray interface, that is less than useful for standard and custom functions expecting an Array.
Vectors do not allow subclassing at all, so they won't help.
Thanks
Unfortunately this is not as straight forward as you think. Check Extending the Array class on Adobe livedocs for the detail method of extending an array.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With