AS3 Overriding

  • Sumen
  • Proficient
  • Proficient
  • User avatar
  • Posts: 421
  • Loc: Rochester or Albany, NY

Post 3+ Months Ago

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
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

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? :)

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 18 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
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.