Use Interfaces and composition to work around the lack of multiple inheritance.

On 10/10/06, Daniel Freiman <[EMAIL PROTECTED] > wrote:

I know that strictly speaking there is no way for an object to inherit from two superclasses, but doesn't anyone know a good workaround to simulate this in actionscript?  Being able to write code in interfaces instead of just method definitions would be a perfect solution to this problem, but a simple test showed me that wasn't possible.  Anyone have any thoughts?

For those who are confused at what I am asking, a contrived but simple example:
Let's say I'm trying to layout a user interface.  I have two types of controls (ComboBoxes, Buttons).  When doubleclicked I want a control to report it's x value so a user can determine if the controls are aligned by x value.  Right now what I'm doing is implementing this ability in a subclass of combobox and of button, and then extending these new classes when I want to create controls with custom functionality.  This is acceptable except I keep adding functionality to my custom superclasses.  Let's say I want to now want the controls to also report their y position.  I have to go back and both my new combobox and button classes, which is annoying and doubles my code.

Any thoughts on a good way around this problem?

thanks

- Dan


__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to