Why can't a class extend traits with method of the same signature?

后端 未结 5 2155
旧时难觅i
旧时难觅i 2020-12-23 12:02

Why do I get the error below? How to workaround it?

I assumed that since A and B compile to (interface,class) pairs, it\'s a matter of choosing the right static meth

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-23 12:41

    This is the diamond problem. Which method hi should be inherited, the one from A, or the one from B? You can get around this as Don suggested, by using a common base trait.

提交回复
热议问题