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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:47:58+00:00 2026-06-16T02:47:58+00:00

When a subclass C is instantiated, it’s known that the constructors of its super

  • 0

When a subclass C is instantiated, it’s known that the constructors of its super classes (say A, and B (B extends A)) will be instantiated earlier than C. So does this mean that:

  1. There are separate memory allocated for A’s instance, B’s instance and C’s instance?
  2. For the instance of subclass C, does it have all the physical memory allocated for the fields inherited from B and A, in addition to its own fields?
  3. and so does B‘s instance has the physical memory for the fields inherited from A in addition to its own?
  • 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-16T02:47:59+00:00Added an answer on June 16, 2026 at 2:47 am

    … it’s known that the constructors of its super classes (say A, and B (B extends A)) will be instantiated …

    Classes are instantiated. Constructors are invoked.

    (It was suggested in an edit that this should be “Objects are instantiated”; however, this isn’t technically correct. Per the same JLS section linked below: “A new class instance is explicitly created when evaluation of a class instance creation expression causes a class to be instantiated.” I.e. you instantiate a class in order to get an object. An object is an instance. You don’t instantiate objects.)

    1) There are separate memory allocated for A’s instance, B’s instance and C’s instance?

    No, there is an instance of the class. I.e. one piece of memory.

    2) For the instance of subclass C, does it have all the physical memory allocated for the fields inherited from B and A, in addition to its own fields?

    Yes: “Whenever a new class instance is created, memory space is allocated for it with room for all the instance variables declared in the class type and all the instance variables declared in each superclass of the class type, including all the instance variables that may be hidden.”

    3) and so does B’s instance has the physical memory for the fields inherited from A in addition to its own?

    As per 1, there is no “B’s instance” in this scenario. There’s only the one instance.

    Source: 12.5. Creation of New Class Instances, JLS 7

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

Sidebar

Related Questions

If subclass in objective-c wants to override a super class's method, does it have
I have a custom NSOperation object that is instantiated from a UITableViewController subclass (MusicTableVC).
I have a subclass of UIView that's instantiated in a XIB file. I need
I have a UITableViewController subclass that's instantiated, depending on where it's used, in a
I have a subclass of UIScrollView that I have set as the view of
I have a UITableViewController subclass with its prototype cells mocked up in the storyboard.
I have created a Class (subclass of NSObject) which will hold all my SQLs/dbConnections
I am trying to define in python a class B, subclass of A, that
I have a subclass that i use alloc and init to instantiate. In the
I have a root UIViewController subclass that has a UITabBar, (I'm not using UITabBarController)

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.