The second solution says
Make interfaces Detached, SemiDetached, and Terraced. Keep Bungalow as an abstract class that extends House. Then have DetachedHouse extend House and implement Detached, and have DetachedBungalow extend Bungalow and implement Detached (the setup for the semi-detached and terraced property types is analogous). You might benefit from drawing a class diagram for this arrangement.
According to the solution above, TerracedBungalow is extending an abstract class Bungalow and implementing an interface Terraced while TerracedHouse is extending an abstract class House and implementing an interface Terraced.
Hence, TerracedBungalow isn't an instance of TerracedHouse while the question claims that TerracedBungalow 'is-a' TerracedHouse (since it says that PropertyCollection has 1020 terraced houses).
The second solution says
Make interfaces
Detached,SemiDetached, andTerraced. KeepBungalowas an abstract class that extendsHouse. Then haveDetachedHouseextendHouseand implementDetached, and haveDetachedBungalowextendBungalowand implementDetached(the setup for the semi-detached and terraced property types is analogous). You might benefit from drawing a class diagram for this arrangement.According to the solution above,
TerracedBungalowis extending an abstract classBungalowand implementing an interfaceTerracedwhileTerracedHouseis extending an abstract classHouseand implementing an interfaceTerraced.Hence,
TerracedBungalowisn't an instance ofTerracedHousewhile the question claims thatTerracedBungalow'is-a'TerracedHouse(since it says thatPropertyCollectionhas 1020 terraced houses).