Answer the question
In order to leave comments, you need to log in
Are there any languages, platforms, where you can inherit a class from two or more base classes, not interfaces?
Without this, it turns out nonsense, here there is a standard, base ListView class, one third-party developer wrote PullToRefreshListView based on it, another - LoadMoreListView, and it is required that one class has the functionality of both, you have to create a new class, again inheriting from ListView, and just copy both, and this is if the source code is open at all, and if it is closed, how can I be according to the idea of the creators of the language, which are usually very "correct" and against reverse engineering, etc.?
Answer the question
In order to leave comments, you need to log in
The question is more like a cry from the heart, because initially it is not clear what you are using. For example, C++ www.c-cpp.ru/books/mnozhestvennoe-nasledovanie supports multiple inheritance.
I would still review the architecture of the project. Since a language that does not support multiple inheritance is chosen for implementation, the limitations of the tool should be taken into account when designing the architecture.
The list of languages with Multiple inheritance is quite extensive. And there is already mentioned C ++.
The main problems associated with multiple inheritance are the coincidence of field and method names. One of these is known as The Diamond Problem. Simply put:
-Class A contains the do()
method -Class B & Class C inherit from A and override do()
-Class D inherits from B & C
What do we get here: new D().do()?
Here on this account Java & C# offer the concept of multiple inheritance BUT from interfaces (+ a new keyword interface is introduced). There are no conflicts anymore, since we are implementing interfaces for each individual class.
But in C ++ there is no concept of an interface as such (and there is no keyword either). It has to be "emulated" by an abstract class. Read more here
P/s The implementation of support for the concept of multiple inheritance depends only on the language, and it is at the mercy of the creators. Some people thought that the number of problems from multiple inheritance would be more than it would help solve problems. And they didn't do it in their language.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question