Day 23 / Mar 31 (Thu)¶
Pair Programming¶
Zoo Inheritance¶
- Create a command-line application that loads a zoo registry (a file with animal names and their count)
- Create a trait
Animal
that definesdef talk
,def walk
anddef numberOfLegs
- Create concrete classes for animals, e.g.
Lion
,Duck
,Cat
,Dog
- Create a sequence of animals and let them
talk
,walk
, and displaysnumberOfLegs
trait Animal {}
case class Lion(...) extends Animal {}
// ...
val animals = Seq[Animal](...)
animals.foreach { a => ??? }
Working in pairs1:
- FIXME
-
The story, all names, characters, and incidents portrayed in this production are fictitious. No identification with actual persons (living or deceased), places, buildings, and products is intended or should be inferred. (cf. All persons fictitious disclaimer) ↩