I try to represent in a UML Class Diagram the following object and features:

  • The Object: A System (e.g. an electronic device) that can be of Type A, B or C
  • If the System is of type A, it has a specific extra attribute (let say "sub-type", which values can be A1 or A2)

I created a Class named "System" and:

  1. Created a class "System_TypeA" that holds an extra attribute named "subSystem" that can take any value within A1 and A2.
  2. Created a generalization relationship beteween the two classes ("System_TypeA" is a "System")

So far, so good.

Now, each System can be the backup system of other Systems. If this is the case, the System should hold a collection of references of the systems it is backing-up

So for this feature, I also created a Class named "Backup_System" and created generalization between the two classes, since a "Backup_System" is a "System".

So how to represent in the Class Diagram the fact that there can be Systems of Type A that are Backup systems (i.e. the problem of multiple inheritance)??

(For info, the implementation should be done in java, so the same problem of multi-inheritance will be faced at implementation.)

  • why was this migrated to programmers? Aug 5, 2014 at 7:26

3 Answers 3


Not quite sure if I understand your question. I think you just have a composition relationship of system to system (see diagram). A system can backup another system.

enter image description here

I don't think you need to look at multiple inheritance here. It's possible to overdo things with inheritance. Try to use composition instead when you can.

  • (+1) Agree, the "backup" feature "sounds" more like composition ...
    – umlcat
    Aug 4, 2014 at 16:18
  • @Oliver Thanks for your reply! You are right, with composition it should be fine. Actually, since all Systems are not back up ones I thought I would represent this specific case of a System through a sub-class... where actually it can be done with a 1 - 0..* composition Aug 5, 2014 at 7:57
  • I have an extra question please: shouldn't it be an Aggregation instead of a Composition? The Backup System can "exist" without the backed up one, isn't it? Aug 5, 2014 at 8:13
  • if it can exist without a backup then you are correct. It should be aggregation instead of composition :) Aug 5, 2014 at 8:46
  • @Oliver: This is not the characteristic distinction between aggregation and composition. Rather, an association is a composition when it represents a part-whole relationship where the parts cannot be shared among two or more composites. See also this answer [stackoverflow.com/a/25120476/2795909] to a related question.
    – gwag
    Aug 18, 2014 at 9:57


each System can be the backup system of other Systems

do you really need a "Backup_system" class? Shouldn't be an association?

Like this

A sample

(click on the image to copy)

  • Thanks for your answer, it really helps! See my comment above. Aug 5, 2014 at 7:58

Your question contains two issues: (1) the general issue of multiple inheritance and multiple classification; (2) the question of how to model backup systems in a conceptual model. I'll try to explain (1) while (2) has been addressed by some other answers already (and indeed, you really need to associate your backup systems with the systems they are supposed to back up).

UML does not have any problem with multiple inheritance, just Java (and many other OO languages) do have a problem with it. In the UML class diagram you just connect your subclass TypeA_Backup_System with the two superclasses TypeA_System and Backup_System using generalization arrows.

However, you may not really want to add a class TypeA_Backup_System, but rather you may mean the (related) issue that you may have specific systems (instances of System) that instantiate both TypeA_System and Backup_System. This is multiple classification, again not supported by Java. For allowing multiple classification in a UML class diagram, you just do not add the constraint keyword disjoint to your generalization arrows, then, by default, the subclasses may overlap, implying the possibility of multiple classification.

  • (+1) For clarifying the "UML does not have any problem with multiple inheritance ...", very common mistake !!!
    – umlcat
    Aug 4, 2014 at 16:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.