ABSTRACT

Unlike inheritance, where a class can only inherit directly from one other class, you can use however many interfaces you like with a single class. The Chair would implement IFurniture and ISeatedFurniture. The Sofa would contain those two as well as ILayingFurniture, and the Table would contain IFurniture and ITableFurniture. Also, because interfaces can also extend one another, the latter three interfaces could all extend the fi rst one as well, making implementation even simpler. Now that you have some basic interfaces defi ned for different furniture purposes, you can mix and match them as needed to apply to a particular piece of furniture.