Im learning about oop just now and am struggling with the difference between inheritance and polymorphism.
If i understand correctly, inheritance defines a type hierarchy and the relationship between classes. Child classes inherit behaviour from the parent class and can provide specialised behaviour of any public interface on the parent.
Polymorphism is that these child classes can provide their own behaviour while still adhering to the parent interface.
This is the same thing isnt it?
You are correct that in most OO languages, inheritance and polymorphism go one with another. But:
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