On 11/11/2015 11:29 AM, Dimitry Sibiryakov wrote: > 11.11.2015 16:22, Jim Starkey wrote: >> Multiple inheritance with common base classes is, in fact, a mess. The >> problem is that the C++ compiler can't really know whether two like >> named methods in different classes are the same and has no way to known >> which to reference in vtable. This shows up when trying to use C++ pure >> virtual classes as Java interfaces. In Java, this isn't inheritance but >> in C++ it is. >> >> An example is the C++ bind of JDBC that Vulcan used internally. >> Statement and PreparedStatement are each pure virtual classes >> PreparedStatement inheriting from Statement. The implementation class >> of PreparedStatement has to inherit from both the PreparedStatement pure >> virtual class and the implementation class of Statement. The compiler, >> however, can't know whether to inherit, say, getResultSet() from the >> implementation class or from the pure virtual class. > New compilers and new C++ standards solved that, AFAIK. >
Ah, yes. The problem seems to be known as diamond problem from the shape of the inheritance graph. The solution, as it were, is virtual inheritance, also known as a wart on a wart. Multiple inheritance is one of many ways that the software gods are telling you that a) your design is screwed up, or b) your implementation language is screwed up. Implementing an interface doesn't require multiple inheritance -- or any inheritance, for that matter -- just a decently designed language. C++ is my implementation language of choice for anything that requires predictable performance and doesn't require a GUI. I've written many hundreds of thousands of lines of C++ code, but C++ is still a badly thought out bloated mess of a language. ------------------------------------------------------------------------------ Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel