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
Inheritance and Polymorphism are cornerstones of object-oriented programming and serve a few different purposes, in short:
among others.
The last point also highlights, why one might use a restricted set of functionality, even in a case the actual implementation provides more than that. Take for example the Collection interface. By using this interface, we focus on methods like isEmpty
, contains
or size
but not the actual implementation.