Scala, Design Patterns, Programming, Delegation, Coding.
Doo", Location(4, 2)) val fox: Fox = new Fox("Robin Hood", Location(6, 4)) val sponge: Sponge = new Sponge("Bob", Location(8, 6)) val listAnimals: List[Animal] = List[Animal](dog, fox, sponge) listAnimals.foreach[Unit](animal => { System.out.println(animal.toString) animal.makeSound() })