Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Aditi Msc   on May 19 In Java Category.

  
Question Answered By: Julian Long   on May 19

Actually the right object  is being called. Its a
principal of polymorphism thru overriding. See even
though the refrence variable is of type Base the
object is that of the derived  class. Accoriding to
polymorphism thru overriding. If the method from the
parent class  is not over ridden in the child class
than the method from the parent class will be called
or else vice versa.

Check out the book by Bruce Eekel "Thinking in Java"

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on How do we cast a Derived class to Base class Or get search suggestion and latest updates.


Tagged: