Since you can do multiple inheritance with class interfaces do you follow some concrete rules to create and organize them so as to avoid overlapping of interfaces for example ?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Java (at least up to Java 7) does not support multiple implementation inheritance, only multiple interface inheritance. I guess you are referring to a situation like this one:
This is not a problem (it works!). If API overlaps, it just merges.
Here is a useful article about multiple inheritance in Java.
I think you are talking about stuff like this:
I don't know any concrete rules to for such situation, because they are very rare. (Not like in C#, there is a construct (explicit interface implementation) for this "use"-case).
In my humble opinion this case is and should be very very rare. Just try to avoid it (/to hold it like this). So it is more a academical, not praxis relevant problem.
The general rule that I follow is Separation of Concerns: every interface should model only one precise aspect or functionality, thus you can inherit multiple interfaces without having overlapping issues. You may want to read also this question, and related answers.