Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8089359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:22:15+00:00 2026-06-05T19:22:15+00:00

I have a class, Pawn, which is the base class for all characters in

  • 0

I have a class, Pawn, which is the base class for all “characters” in the game with properties such as health, that can move and die or speak, etc. One class extending this is the “Boy” class. The “Boy” class is the player controlled character in this game.

In order to control character “states”, state classes are created. These have methods such as onEnterState, onStateTick and onLeaveState. A state might be used to represent crouching, walking, jumping, and will be send messages such as “keyPressed” “<-” to handle or ignore as it choses.

My problem is that my base “state” class has methods as follows:

function onEnter ( pawn:Pawn ) :void;
function onLeave ( pawn:Pawn ) :void;       
function onGameTick ( pawn:Pawn ) :void;        
function onAnimEnd ( pawn:Pawn ) :void;

As you can see this is actually an interface, but I did try base classes first until it became apparent that ActionScript3 doesn’t like abstract classes much.

So anyway, a class “BoyJumpState” would obviously need to extend/implement this class/interface to ensure that the public methods are there for interaction, however this is hindered by the fact that ActionScript will not allow me to extend with, say, this:

public override function onEnter ( boy:Boy) :void { trace("Hey"); }

This is rejected compile-time because it doesn’t match the blueprint (i.e it doesn’t accept a Pawn). However, I need it to accept a Boy because methods specific to that class need to be utilised in the method body!

I’m figuring my original interface is the problem, and that I should be specifying that the parameter should instead extend pawn and not actually need to be one, however I’m not seeing any way to implement this in ActionScript.

…or I could be completely on the wrong track, in which case advisement would be gratefully received!

I realise I could not have the inheritance going on, but the game I’m making is more of a practice in Object Orientated Programming as it’s more large-scale than what I’m used to. However I’ve moved out of my comfort language (Java) and I’m really beyond myself as to what to do here.

Any help would be appreciated, thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T19:22:17+00:00Added an answer on June 5, 2026 at 7:22 pm

    You don’t need to override the overridden method’s signature to match a covariant type. If you need a specific type in a subclass’s method, you have to check/cast in the overridden method though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Class which Extends View I'm able To Move one Image Over another
I have class A and B which inherit from Base. Base has a private
I have class that extends BroadcastReceiver and gets all new sms. When I get
I have class which has a method that needs to return three DataTables. I
I have class method that returns a list of employees that I can iterate
I have class (MyCustomWebView) that extend webview can i do something like this ?
I have: class BASE{ public: virtual void func1() = 0; }; Then I have
I have class Building in which i have one class member NSMutableArray *subnode.I have
I have class Question < ActiveRecord::Base has_many :tasks, :as => :task end class QuestionPlayer
I have class which implements Countable, ArrayAccess, Iterator and Serializable. I have a public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.