How do I implement multiple kinds of an object in OOP?

Posted by Jeremy Rudd on Stack Overflow See other posts from Stack Overflow or by Jeremy Rudd
Published on 2010-04-29T14:34:04Z Indexed on 2010/04/29 14:37 UTC
Read the original article Hit count: 295

Filed under:
|
|
|

I have multiple kinds of an object, say Car for example.

Do I have each kind in an inherited class/subclass of Car?

Do I place these under a cartype namespace so as not to mess up the main namespace?

Then later when I need an array of cars, should I declare it as var currentCars():Car or var currentCars():Object? Would the former support any subclass of Car?

© Stack Overflow or respective owner

Related posts about beginner

Related posts about oop