Your First Programming Language Greatly Influences How You Think About Code
hackernoon.comObject-oriented programming, inheritance, and subtyping may have specific meanings that don't translate into other languages, depending on the first language you learn.
Java is the first language I learned in my career. Its structure is foundational in my early years of understanding programming concepts. After going through several other languages with very different approaches, I've widened my point of view. Today, I want to reflect on the idea of inheritance.
Inheritance in Java
In Java, the idea of inheritance is tightly coupled with the concept of subtyping. Subtyping is the implementation of a IS A relationship. For example, the Rabbit
class is a subtype of the Mammal
class. Henceforth, a Rabbit
instance has all the behaviour of a Mammal
: it inherits the behaviour.
Because of this, you can pass a Rabbit
instance when a method ...
Copyright of this story solely belongs to hackernoon.com . To see the full text click HERE