flash - function override, returning Vector with specialized type -
flash - function override, returning Vector with specialized type -
is possible implement subclass, overrides function, returns vector specialized instances?
example:
class classa{ protected _vector:vector.<displayobject>; public function vector():vector.<displayobject>{ homecoming _vector; } } class classb extends classa{ public override function vector():vector.<sprite>{ homecoming vector.<sprite>(_vector); } }
when seek to this, "illegal override" error @ compile time. think that's because functions signatures aren't identical. how can solve otherwise?
this main problem vector class in actionscript3. prevents form of polymorphism. need somehow remember kind of objects class returns. easiest way isn't overriding function, leaving , casting each element appropriate form.
flash actionscript
Comments
Post a Comment