I have come across this new method definition. Need explanation what exactly happens here.
Parent trait
sealed trait Generic{
def name : String = name // what is the body of this function call?
def id : Int = id
def place : String = place
}
Child case classes
case class Capital(
countryName : String,
override val id: Int,
override val place:String
) extends Generic
warning: method place in trait Generic does nothing other than call itself recursively
I get this warning message is there anything wrong in using these types of methods?- How exactly compiler treat these type of function calls
def name : String = name
? - Is it this call treats its body as its method name?