CS 245 - Programming Languages

Lab 8

Kotlin classes

In this lab you will be writing classes with inheritance in Kotlin. Then you will wite a main method that illustrates the use of those classes. Finally, also in the main, use those classes to validate that Kotlin uses dynamic dispatch.

In all of the programs below you may NOT use

  1. any variable declared to be a var (either explicitly or implicitly)
  2. Any loop construct
Consider the following UML:
Write a set of classes that implement this UML. (The colors of text inthe UML are irrelevant). You may use properties or methods for any of the elements in the UML.

You must use inheritance. Dog and cat both extend animal. WorkingDog must extend Dog. Within the classes new properties or methods are indicated by the presence of types.

More Requirements

What to hand in

Send email to gtowell245@cs.brynmawr.edu with the file containing your classes and main function. In addition, write 1-3 sentences that describe how you showed that kotlin uses dynamic dispatch.