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 7787721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:45:35+00:00 2026-06-01T20:45:35+00:00

what is the difference between these snippets?: constructor: function(config) { this.initConfig(config); } constructor: function(config)

  • 0

what is the difference between these snippets?:

constructor: function(config) {
    this.initConfig(config);
}

constructor: function(config) {
    this.callParent(arguments);
}

constructor: function(config) {
    this.superclass.constructor.call(this, config);
}

AND, how does it differ to be overriding OTHER methods than constructor?

  • 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-01T20:45:37+00:00Added an answer on June 1, 2026 at 8:45 pm

    The second and third snippet are functionally equivalent. callParent is just a cleaner and simpler way to invoke the parent’s function instead of going through the superclass property.

    The first example is completely different. For one, it does not call the parent’s constructor. This is usually bad news. The base class usually has some initialization that needs to get done, and forgetting to call the parent for constructor (and initComponent) is a common source of bugs.

    initConfig is a convenience method which will:

    • merge your object’s initial config with the config that is passed in
    • create getters and setters for all properties in the config
    • apply the config to the object

    This is entirely different from invoking the parent constructor. What invoking the parent constructor does is entirely dependent on what it’s written to do. Some will use initConfig, some won’t, and others will do similar things that initConfig does, but manually.

    It’s not necessary to use initConfig, and it’s even dangerous at times. But that’s another story altogether (for Ext 4.1, initConfig looks to be hopefully harmless and not contain the same dangerous side effects that it has in 4.0)

    Side Note

    Just to point out. In the second and third snippet, the constructor is not needed. If your constructor is only calling the parent’s constructor, then you can leave your constructor out altogether.

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

Sidebar

Related Questions

What's the difference between using these two jQuery snippets? .append( $(this).contents() ); // and
What is the difference between these code snippets? 1) $f = 12.044545; printf(%f,$f); vprintf(%f,$f);
What is the difference between these two code snippets? open (MYFILE, '>>data.txt'); open (MYFILE,
Help me please to find out what's the difference between these two code snippets:
Is there a difference between these two create table snippets? One includes CONSTRAINT keyword,
What is the difference between these two code snippets: object = nil; [object release]
Is there a difference between the following two snippets for this given class? class
What is actually the difference between these two casts? SomeClass sc = (SomeClass)SomeObject; SomeClass
What is the difference between these two pieces of code type IInterface1 = interface
What is the difference between these three heavily related fields? Is there one specific

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.