In object-oriented programming, I have learned the concept of subtyping
and inheritance
.
I thought they're the same thing, in the beginning. But I was told that they're totally different.
So what's there difference? What's there relationship?
Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. It only takes a minute to sign up.
Sign up to join this communityIn object-oriented programming, I have learned the concept of subtyping
and inheritance
.
I thought they're the same thing, in the beginning. But I was told that they're totally different.
So what's there difference? What's there relationship?
See the following discussions in other stack exchange groups.
See discussion in https://stackoverflow.com/questions/23592131/what-is-the-difference-between-subtyping-and-inheritance-in-oo-programming
Also see https://cstheory.stackexchange.com/questions/10620/how-does-inheritance-differ-from-subtyping
However there is some differences of opinion. See Inheritance Is Subtyping as well as Inheritance Is Not Subtyping