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

  • SEARCH
  • Home
  • 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 6038601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:14:44+00:00 2026-05-23T06:14:44+00:00

I am a little confused by this concept. If I override a public function

  • 0

I am a little confused by this concept.

If I override a public function in a base class, I would have thought that this override function is called and the original is ignored? though this doesn’t seem to be the case…

public class AbstractScreen extends Sprite
{

    public function AbstractScreen() 
    {

    }


    public function updateLanguage():void
    {
        trace("WARNING: need to override public function updateLanguage()");
    }
}

public class Start extends AbstractScreen
{
    override public function updateLanguage():void
    {
        title.text = _model.language.start
        title.setTextFormat(titleFormat);
    }
}

public class ViewManager extends Sprite
{
    private var _model:Model;
    private var _screens:Array;


    public function ViewManager(model:Model) 
    {
        _model = model;

        _model.addEventListener(AppEvent.INIT_VIEW, initViews);
        _model.addEventListener(AppEvent.UPDATE_VIEW, updateView);
        _model.addEventListener(AppEvent.CHANGED_LANGUAGE, changeLanguage);
    }

    private function initViews(e:AppEvent):void
    {
        trace("View Manager: initViews");
        _screens = new Array(new Start(_model), new TakePhoto(_model));
        dispatchEvent(new ViewEvent(ViewEvent.VIEW_READY));
    }

    private function changeLanguage(e:AppEvent):void
    {
        for each (var screen:AbstractScreen in _screens)
        {
            screen.updateLanguage();
        }
    }
}

If my model dispatches a CHANGED_LANGUAGE event, the text in the views gets updated, But I also get a trace of “WARNING: need to override public function updateLanguage()” What could I be doing wrong?

  • 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-05-23T06:14:44+00:00Added an answer on May 23, 2026 at 6:14 am

    You are right, this should not call the base class function. Are you sure there is no call to

    super.initLanguage()
    

    within your override?

    Most IDE’s add this call in the function body automatically, if they create an override for you.

    EDIT

    From your edit I see your are iterating over two objects of the types Start and TakePhoto. I assume TakePhoto is also derived from AbstractScreen and the trace may be comming from this one.

    Also I suggest to use the abstract base class in your iteration.

    for each (var screen:AbstractScreen in _screens)
    {
        screen.updateLanguage();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a little bit confused by this scenario: I have a class that implements
I am little bit confused about this statement that I read in a book
I am a little confused here. I would like to do something like this:
I'm a little confused by this. I notice that some web APIs use the
I am a little confused with this matter. I am designing an ORM class
I'm a little confused about this behavior from the ruby (1.9) interpreter class Foo
I`m a little confused about this point. Everything that I found in books, blogs,
I am a little confused by this snippet of code (presented in the CocoaFundamentals
So I'm a little confused by this terminology. Everyone refers to Asynchronous computing as
I'm a little confused as to why this doesn't give an error. I found

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.