AS3 Overriding

  • Sumen
  • Proficient
  • Proficient
  • User avatar
  • Joined: Jun 10, 2004
  • Posts: 421
  • Loc: Rochester or Albany, NY
  • Status: Offline

Post September 16th, 2009, 12:10 pm

I've only recently been working with actionscript and I got a little sad when a design principle from java doesn't exist in it. Abstract Classes.
Anyway I have a class Gesture. There are several subclasses of gesture, such as AimGesture

So I have another class which recieves a reference to an AimGesture class as type object. I want to be able to cast the object as a Gesture and then call a method. But I want the method to perform differently depending on what type of gesture it is.

My question is, if I override a method in Gesture in the AimGesture class, and then have a reference to the AimGesture object (casted as Gesture) which method gets called: The one in Gesture or the override in AimGesture.

If its not the override, i can always redesign how things are working but I would like a way to implement this concept cleanly... in the future

-Thanks for any help
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post September 16th, 2009, 12:10 pm

  • IceCold
  • Guru
  • Guru
  • User avatar
  • Joined: Nov 05, 2004
  • Posts: 1254
  • Loc: Ro
  • Status: Offline

Post September 17th, 2009, 6:02 am

I wonder, wouldn't it be both easier and more self evident to just test it? I find that is way better to learn by doing than by theory. Theory is good up to a point, then actually doing is preferred. What would be the purpose of theory if not putting it into practice? Unless you want to make philosophy :D

And yes, overriding the method will obviously call the override method, otherwise what would be the purpose of overriding? :)
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 27 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.