Do interfaces solve the “deadly diamond of death” issue?

后端 未结 6 739
长情又很酷
长情又很酷 2021-01-03 03:02

Do interfaces solve the deadly diamond of death problem?

I don\'t think so, for example:

// A class implementing two interfaces Interface1 and Interf         


        
6条回答
  •  情深已故
    2021-01-03 03:15

    Java prevents multiple concrete/abstract class inheritance, but not multiple interface inheritance. With multiple interface inheritance you inherit abstract methods, not implementation. See this post with a good explanation and examples: https://web.archive.org/web/20120724032720/http://www.tech-knowledgy.com/interfaces-sovles-diamond-death/

提交回复
热议问题