Scala, Design Patterns, Programming, Delegation, Coding.
code implements the before example through this advice. trait Animal { val name: String var location: Location def makeSound(): Unit def toString: String } case class Location(x: Int, y: Int) class MovAnimal { def movDirection(location: Location, x: Int, y: Int): Location = { Location(location.x +