title: Why should I reference the base class when I can access all the methods just as well by referencing the subclass?
body: <p>I am learning java concepts.
  I got a doubt in java inheritance concept.
  In inheritance we can assign subclass instance to a base class reference
  and with that we can access only base class function.
  and we can assign any subclass instance in the hierarchy of inheritance to base class reference.For an type of instance assigning to a particular base class reference we can access only base class functions and i didn't find any difference.</p>
  
  <p>Can any one give me actual concept
  why we have to assign subclass instances to base class references?
  what is the need to do that? 
  Instead we can access those base class functions from subclass reference only know.</p>
  
  <p>Explain by considering a particular base class and many subclasses in the hierarchy.</p>