Kotlinlearncs.online LogoJava
Return to List

Solve: Simple Cat Inheritance

Created By: Geoffrey Challen
/ Version: 2020.10.0

Create a public class named Cat. Cat should inherit from the Feliform class shown below:

(You do not need to define Feliform.)

You should provide a public constructor that allows each Cat to be named (using a String) when it is created. assert that the passed name is not null. You should not expose the name and do not need to provide either a setter or a getter for it. You should pass the type "cat" to the Feliform constructor when creating a Cat.

Cat should override toString and return a String in the following format: "(name) is the best cat".

Related Lessons

Stuck? You may find these lessons helpful: