| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
...
Join Date: Mar 2005
Posts: 248
|
I'm curious if it's appropriate to do something like in the subject header:
var x:Superclass = new Subclass(); |
|
|
|
|
|
#2 |
|
rather be programming
Join Date: Feb 2005
Location: City of Angels
Posts: 10,000
|
yes, in fact it is one of the key principles of OO: Program to the interface and not the implementation.
__________________
I'm old enough to know better and young enough to do it anyway. -- maskedman |
|
|
|
|
|
|
|
|
#3 |
|
...
Join Date: Mar 2005
Posts: 248
|
Awesome!
I'm following the crowd and reading over the Head First Design Patterns book and I'm playing around with the examples in the first chapter. I wanted to make characters who could equip "equipment" objects regardless of what subclass of equipment it might be (hacksaw subclass, pastry subclass, tophat subclass, etc). I just wanted to make sure I was interpreting things correctly. |
|
|
|
|
|
#4 |
|
rather be programming
Join Date: Feb 2005
Location: City of Angels
Posts: 10,000
|
yup, of all the things I've learned that....there is a reason while that is the first rule. It is essential to polymorphism.
good luck with your reading. I read the head first book, but I don't remeber the examples you are giving....
__________________
I'm old enough to know better and young enough to do it anyway. -- maskedman |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| FlvPlayBack-component... | Electrix | Components | 10 | 05-28-2008 07:04 PM |
| Don't Repeat the Arraycontent | ashishkummar2 | ActionScript 2.0 | 8 | 07-07-2007 12:36 PM |
| Game Over...now what? | notaflasher | ActionScript 2.0 | 15 | 06-13-2007 05:24 AM |
| Problem with a for...in loop in a for...in loop | VictoriaWelby | ActionScript 2.0 | 2 | 04-10-2007 12:20 AM |
| Variable Scope Issues.. | slalonde44 | ActionScript 2.0 | 1 | 03-02-2007 02:52 AM |