A person who could speak...

Report a typo

There's a trait that has the talk method:

trait Talkative:
  def talk: String

Override the talk method of the created class Human, extending Talkative so that it could greet by name.

The following code must work:

val human = Human("Sam")
human.talk // Hello, I'm Sam

Sample Input 1:

Sam

Sample Output 1:

Hello, I'm Sam
Write a program in Scala 3
class Human(name: String) extends Talkative:
???
___

Create a free account to access the full topic