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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:16:55+00:00 2026-05-14T22:16:55+00:00

recently I went through the inheritance concept. As we all know, in inheritance, superclass

  • 0

recently I went through the inheritance concept.

As we all know, in inheritance, superclass objects are created/initialized prior to subclass objects. So if we create an object of subclass, it will contain all the superclass information.

But I got stuck at one point.

Do the superclass and the subclass methods are present on separate call-stack?
If it is so, is there any specific reason for same?
If it is not so, why they don’t appear on same call-stack?

E.g.

// Superclass
class A {
    void play1( ) {
        // ....
    }
}

// Subclass
class B extends A {  
    void play2( ) {  
        //.....   
    }
}

Then does the above 2 methods i.e play1( ) and play2( ) appear on separate call stack?

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-05-14T22:16:56+00:00Added an answer on May 14, 2026 at 10:16 pm

    There is not necessarily any relation between a call stack and inheritance. In fact frequently there isn’t. If a superclass method is overridden in a child then it is the child’s method that is called – the superclass method is not executed at all, unless there is code to explicitly do that in the child method. The superclass method will not appear at all in the call stack – unless it is called explicitly by the child method.

    class A {
      void play1() {
        //...
      }
      void play2() {
        //....
      }
    }
    class B extends A {
      void play1() {
        //...
      }
    }
    B b = new B();
    b.play1(); // 'first' call
    b.play2(); // 'second' call
    

    A.play2() appears on the call stack only during “second call”. B.play1() appears on call stack only during “first call”. A.play1() never appears on the call stack and is never executed.

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

Sidebar

Related Questions

I recently went through my CSS file and switched all my six-digit hexadecimal codes
I recently started learning Emacs . I went through the tutorial, read some introductory
As recently as several years ago, the developers actually made the builds that went
I'm a pretty new C# and .NET developer. I recently created an MMC snapin
I have installed Ruby 1.9.1 recently. Everything went fine, I installed the devkit, gems,
Recently Jeff has posted regarding his trouble with database deadlocks related to reading. Multiversion
Recently I have been investigating the possibilities of caching in ASP.NET. I rolled my
Recently, I started changing some of our applications to support MS SQL Server as
Recently, I've been dealing with an error with accessing MAPI via the .NET framework
Recently our site has been deluged with the resurgence of the Asprox botnet SQL

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.