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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:17:08+00:00 2026-06-01T11:17:08+00:00

I read somewhere that, overriding is the means by which you get polymorphism. Polymorphism

  • 0

I read somewhere that, overriding is the means by which you get polymorphism. Polymorphism is the ability for an object to vary behavior based on its type.

Now can i just say that when different subclasses override the member of a parent class then it gives me polymorphism?

Also

class A
{
public void hello()
{
printf("in A");
}
}

class B extends A
{
public void hello()
{
printf("in B");
}
}

class C extends A
{
public void hello()
{
printf("in C);
}
}

Now if i do

B b=new B();
C c=new C();
A a1=b;
A a2=c;
a1.hello();
a2.hello();

now will a1 use all the members of b those are inherited from A and hence print in B; and similarly for a2?

  • 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-01T11:17:10+00:00Added an answer on June 1, 2026 at 11:17 am

    Through inheritance, a class can be used as more than one type; it can be used as its own type, any base types, or any interface type if it implements interfaces
    Polymorphism is important not only to the derived classes, but to the base classes as well. Anyone using the base class could, in fact, be using an object of the derived class that has been cast to the base class type.

    In other words you have polymorphism every time using a base class you can have “different” behaviors.Overriding is just a way to have polymorphism but think about interface you don’t override any methods but you can still have polymorphism (implementing the interface in different ways)

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

Sidebar

Related Questions

I read somewhere that NTP is based on UDP and there's no security built
I read somewhere that you would never run syncdb on a database, post its
I read somewhere that it is disastrous to use free to get rid of
I read somewhere that string 0123456789ABCDEFFEDCBA987654321089ABCDEF01234567 is 192 bit (24). Its written that it
I've read somewhere that offline_access is/will be deprecated. If I understood correctly this means
I read somewhere that with NSString in an object, one has to use copy
I've read somewhere that you can snap the object after it has been moved,
I read somewhere that when creating a HTML email, you should use the table-based
I've read somewhere that events of ASP .NET are based on View State of
I read somewhere that one should never use error conditions as normal program flow.

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.