On 11/11/2015 6:52 AM, Adriano dos Santos Fernandes wrote:
> On 11/11/2015 09:37, Dimitry Sibiryakov wrote:
>> 11.11.2015 12:32, Adriano dos Santos Fernandes wrote:
>>> I can write almost any code mixing their common part in a single class,
>>> avoiding duplicate declarations, with our without cloop, and as the one
>>> you say, it will not work too, but will be much more compact!
>>     Multiple inheritance of normal classes work and work predictable.
> Definitively, not always out of the box when they have common base classes.
>
>

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.

The workaround requires all "inherited" virtual methods to be defined.  
Each is trivial, consisting of a qualified call to the correct base 
method, but it is a pain in the butt.

Another example of the Java language designers being smarter than the 
C++ language designers.  Maybe, some day, C++ will have interfaces, too.

------------------------------------------------------------------------------
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to