-
Why does Vector not inherit from Array?
1067: Implicit coercion of a value of type __AS3__.vec:Vector.<Foo> to an unrelated type Array.
Really? Doesn't Vector include all the properties, methods and signatures of Array? Is there some low level reason Vector cannot be cast to Array?
-
Yes, there is a reason: Vector class is designed to be faster. Thats why it is created entirely from scratch.
-
Well, now I think about it, guess it is because Array is (still) a dynamic class where Vector is not.
var array:Array = new Array();
trace( array.foo ); //no compile error here
var vector:Vector.<Object> = new Vector.<Object>();
trace( vector.foo ); //will not compile
But I wonder why adobe didn't define an interface, IArray or something.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|