What is the difference between
extends(inheritance)
and
override(polymorphism)
?
Extends: we create a new class(Inherited class) with the features of Existing (class Base class) and some additional features. This comes in picture in case of inheritance.
Example: NokiaBasic Handset. NokiaNSeries(Extends the features of NokiaBasic Handset features)
Overriding: comes to picture when functionality changes in the derived class. We override the functionality of a particular function in a derived class(Dynamic Polymorphism).
Example: All the functionality which NokiaBasicHandset has, are implemented in NokiaNSeries but there is a difference in the way we operate. (Picking a call, sending a message, sharing a file, etc.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With