1

Is there any notion of " Interface inheritance is public inheritance, while implementation inheritance is private inheritance" in java?

I have read this post.

0

1 Answer 1

0

I read the post you linked. In this post, Péter Török states about Private Inheritance the following:

However, if B privately inherits from A, B is-implemented-in-terms-of A: only the implementation of A is inherited, not its interface. Thus (references/pointers to) B objects can not be used in places where A objects are expected.

I don't think there is such thing in Java as Private Inheritance, at least in the terms expressed above.

So, after reading the post and considering that in Java:

  • Interface Inheritance is related to interfaces and classes implementing this interfaces, and
  • Implementation Inheritance is related to class specialization

I think it is not possible the case where you create a Class B that implements an Interface A or extends a Class A, and this Class B couldn't be used as A.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.