Let's take a simple example: You require to store information about Cats and Dogs. You identify that Cats and Dogs have a number of behaviors in common, and so you identify a common Animal interface.
You need to code three interfaces, Cat, Dog and Animal with the Cat and Dog interfaces both extending the Animal interface.
package curam.inheritance; import curam.util.persistence.Insertable; import curam.util.persistence.OptimisticLockModifiable; import curam.util.persistence.StandardEntity; import curam.util.persistence.helper.Named; public interface Animal extends StandardEntity, Insertable, OptimisticLockModifiable, Named { public void speak(); }
package curam.inheritance; public interface Cat extends Animal { public int getNumberOfLivesRemaining(); public void setNumberOfLivesRemaining(final int value); }
package curam.inheritance; public interface Dog extends Animal { public String getFavouriteTrick(); public void setFavouriteTrick(final String value); }