ActionScript 3.0 - Why Custom Classes Can Only Extend From One Superclass?
i understand that one or more Interface
declarations can be implemented in a custom class to remedy the inability to extend from more than one superclass, at the cost of having to actually implement the required functions of an interface, of course, but why is it not possible to extend from multiple classes?
is it an issue concerning fundamental OOP design? perhaps it'开发者_Python百科s an issue of performance? if there is no real reason other than following the ECMAScript standard, might we have this ability in a future versions of the ActionScript?
thoughts?
is it an issue concerning fundamental OOP design?
Yes. The diamond problem is one of the most well-known and cited issues with multiple inheritance.
I recommended you to often use composition instead of inheritance. You can read a simple example here: http://www.javaworld.com/javaworld/jw-11-1998/jw-11-techniques.html
That's one of various good pratices around OOP.
@BoltClock has the right of it, but if you really really need it, you can hack it using the #include
statement: http://flex.sys-con.com/node/316359 (or Mixin in flex I think)
精彩评论