title: UML mapping: container class with objects of two types
body: <p>Suppose that there is one container C that can contain objects of type A and B.
  C cannot be empty and can only contain 1 object of each type. That means that C contains one of the following:</p>
  
  <ul>
  <li>1 object of type A</li>
  <li>1 object of type B</li>
  <li>1 object of type A + 1 object of type B</li>
  </ul>
  
  <p>To map this problem in UML class diagram I tried these...</p>
  
  <p><img src="https://i.stack.imgur.com/OqCcu.png" alt="enter image description here"></p>
  
  <p>... but none of them map the problem since that in the left diagram the container C can be empty and in the right diagram the container C can contain two objects of type A (or B).</p>
  
  <p>So my question is: how is it possible to map this problem?</p>