David Moner wrote:

> I was exaclty thinking about this while seeing this proposal for the 
> ITEM_STRUCTURE change to a VALUE_CLUSTER:
> 
> http://www.openehr.org/wiki/display/spec/openEHR+2.x+RM+proposals+-+lower+information+model#openEHR2.xRMproposals-lowerinformationmodel-CandidateA.1AddVALUECLUSTER%2CRemoveITEMSTRUCTUREtypes
>  
> 
> It is an example of multiple inheritance not supported by Java and some other 
> languages.


Multiple inheritance is easily implemented in Java and C# ... via interfaces.

The problem is that you often need to duplicate code. For example, in that 
diagram, VALUE_CLUSTER inherits from both ELEMENT and CLUSTER. In C# you can't 
do that, so you would probably declare ValueCluster as implementing two 
interfaces, IElement and ICluster; then you would copy the implementations of 
Element and Cluster into ValueCluster. Java would do something similar, 
although the naming convention of the interfaces might be different. (In C#, 
you might even decide to avoid some of the code duplication by using extension 
methods. Or maybe not ... it might cause more trouble than it solves.)

Peter


Reply via email to