title: Modeling the living place of a Person
body: <p>I have a <code>dwelling</code> class which is a generalization of <code>house</code> and <code>building</code>. Those classes have their own properties, and the class <code>floor</code> is a composite of <code>building</code>.</p>
  
  <p><a href="https://i.stack.imgur.com/pNtko.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pNtko.png" alt="UML Class Diagram"></a></p>
  
  <p>I would like to associate a <code>person</code> class. If a person lives in a building, I want to be able to retrieve the matching floor. The best solution I found is to import all properties in the parent class and make them nullable.</p>
  
  <p><strong>Q:</strong> Is there a more elegant way to deal with such scenario ?</p>
  
  <p><strong>EDIT:</strong> I forgot to say (and to draw) that <code>dwelling</code> is an abstract class, as a <code>:dwelling</code> is either a <code>:building</code> or a <code>:house</code>. As I cannot predict in which a <code>:person</code> will be, the relationship should only involve the <code>dwelling</code> class. But how instantiate once I know ?</p>