Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-31-2007, 11:42 PM   #1
JanTheMan
Member
 
Join Date: Sep 2005
Posts: 34
Cool can YOU extend THIS?!

heres the tricky thing

imagine having some class which extends displayObject

you want to reuse it as much as possible and want it to be extended by Shape and Sprite classes.

there must be a straight forward way or its impossible, but so far i have figured out its not possible please proof im wrong.. i know you can use include and import but i dont realy want to use that
JanTheMan is offline   Reply With Quote
Old 05-31-2007, 11:46 PM   #2
Assertnfailure
as[org].addListener(this)
 
Assertnfailure's Avatar
 
Join Date: Dec 2005
Location: LA, California
Posts: 837
Default

Welcome to OOP design principles

If you want a class that can change its inheritance, you're better off taking more of a compositional approach. (has a, vs is a)
Assertnfailure is offline   Reply With Quote
Old 05-31-2007, 11:54 PM   #3
JanTheMan
Member
 
Join Date: Sep 2005
Posts: 34
Default

dont you welcome me
what do u mean? just copy the code to both of classes?
JanTheMan is offline   Reply With Quote
Old 06-01-2007, 12:20 AM   #4
pan69
Fight ya for a pint!
 
pan69's Avatar
 
Join Date: Jan 2005
Location: Sydney / Australia
Posts: 1,706
Default

No, Composition (has a) and Inheritance (is a) are two different types of relationships. What Assertnfailure is saying is that instead of using inheritance, you would be better of using composition.

http://www.lukeschreur.com

Last edited by pan69; 11-04-2012 at 07:07 PM.
pan69 is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can a class extend multiple classes? audiowizard ActionScript 2.0 8 07-19-2006 10:41 PM
Extend Button Componenet kvarga Components 2 11-22-2005 03:34 PM
extend TextFormat using prototyping Sly2k ActionScript 2.0 11 06-02-2005 01:01 PM
Is there a way to extend a function? ArachPres ActionScript 2.0 2 10-10-2004 05:52 AM
How to extend SimpleButton? hugobossv8 Components 3 06-17-2004 12:39 AM


All times are GMT. The time now is 06:06 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.