using System.Collections.Generic;
namespace ConsoleApplication1
public virtual void ShowData()
Console.WriteLine("I am a house, my area is {0} m2.", area);
public Door(string color)
Console.WriteLine("I have a door, it's color is {0}.", color);
class SmallApartment : House
public override void ShowData()
Console.WriteLine("I have an apartment, my area is " + area + "m2");
public Person(string name, House house)
Console.WriteLine("My name is {0}.", name);
SmallApartment mySmallApartament = new SmallApartment();
Person myPerson = new Person();
myPerson.House = mySmallApartament;