Extending Interfaces

By extending interfaces, you can combine methods of multiple interfaces. In the previous example, the interface FamilyPGHouse combines the methods of the interfaces ChildFriendly, PayingGuestHouse, and GuestHouse. When a class implements an interface, it should implement all the methods defined in the interface and its base interfaces, unless it’s declared as abstract. If, for example, a class implements the interface PayingGuestHouse, that class must implement method paidBreakfast() defined in the interface PayingGuestHouse, and method welcome() defined in the interface GuestHouse.

Last updated

Was this helpful?