Why is multiple inheritance not supported in most of programming language?

后端 未结 3 1568
小鲜肉
小鲜肉 2020-12-05 16:17

Why is multiple inheritance not supported in most of programming language?

I could really use this feature to develop different layout of application?

3条回答
  •  没有蜡笔的小新
    2020-12-05 16:56

    One reason not to support it is ambiguity of method resolution.

    http://en.wikipedia.org/wiki/Diamond_problem

    However, I'm not sure what you mean by "most" programming languages. Many that are in use today support it directly (C++, Python, Perl, OCaml) or have a mechanism for similar functionality (Ruby and Scala come to mind).

提交回复
热议问题