views:

41

answers:

2

I'm creating a class that extends another class.

public class ASClass extends UIComponent{

}

but I'm trying to make it extend multiple classes. Is this somehow possible? I read it may be possible through composition?

+1  A: 

You can, but only through a slightly hacky method of using the #include pragma. Here is a Darron Schall article explaining how: http://www.darronschall.com/weblog/2006/10/multiple-inheritance-in-actionscript-3.cfm.

dr_tchock
Is this similar to `compositions` or how is it different from it
cooper
@cooper: this is similar to copy and paste
back2dos
+2  A: 

You're asking about multiple inheritance; which is not supported in ActionScript [or as far as I knew, most modern languages w/ OO Features]. You may think you want the feature, but multiple inheritance opens up a huge can of worms.

I suggest you look into interfaces as they are the intended alternative to multiple inheritance. Here is some Adobe Documentation on Interfaces. Interfaces do not allow you to share an implementation, though.

You can use ActionScript includes as one way to share implementation between multiple files.

www.Flextras.com