The first Building gets printed out in the Terrace constructor, which relies on base class Building's constructor.
The second Building gets printed out in the constructor for b.
Next, the compiler takes this new Buliding and tries to convert it to a House as part of the cast attempt. That fails, because b's run time dynamic type is Building, which cannot be cast to the more specific type House.
By contrast, House b = (House) new Terrace();
would work, because in that case b's runtime type is Terrace, so the cast would be to a more generic type.