April 2018
Intermediate to advanced
396 pages
11h 8m
English
What if our greeting traits have more methods that have the same signatures, but a different return type? Let's add the following declaration to FormalGreeting:
def getTime(): String
Also, add the following to InformalGreeting:
def getTime(): Int
We will have to implement these in our Greeter class. However, the compiler will not allow us the message that getTime was defined twice in, which shows that Scala prevents such things from happening.
Read now
Unlock full access