c# - "A class can directly inherit multiple interfaces, but can only directly inherit one class (including abstract classes)." Isn't it inconsistent with C++'s multiple inheritance?
ringa_lee
ringa_lee 2017-05-31 10:36:49
0
2
2189

"A class can directly inherit multiple interfaces, but can only directly inherit one class (including abstract class)." Isn't it inconsistent with C's multiple inheritance?

ringa_lee
ringa_lee

ringa_lee

reply all (2)
某草草

It should be that a class intelligently inherits from a class (including abstract classes), but can implement multiple interfaces
Inheritance is direct inheritance, and interfaces are certain specifications. I follow certain specifications
I think this is a better understanding

c++ is originally a Simular system, so I won’t talk about it
Multiple inheritance doesn’t mean much

    黄舟

    C++’s multiple inheritance is truly multiple inheritance, more powerful, but also less easy to use. Therefore, languages such as Java simply do not allow inheritance of multiple base classes. They can only inherit one base class and implement multiple interfaces. I can’t say which of these two methods is better, but they each have their own merits. I remember it was said in "CLR via C#" that in order to avoid multiple inheritance, C# can only inherit a single class, which resulted in many pitfalls. Anyway, if you are not a language expert, there is usually this compromise solution, and we can use it

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!