Chunky Chunk
Chunky Chunk

Reputation: 17217

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'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?

Upvotes: 1

Views: 228

Answers (3)

divillysausages
divillysausages

Reputation: 8033

@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)

Upvotes: 1

Marcelo Assis
Marcelo Assis

Reputation: 5194

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.

Upvotes: 3

BoltClock
BoltClock

Reputation: 723578

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.

Upvotes: 8

Related Questions