In scala, you write all init in the / trait / object class:
class Foo(price: Int) {
val currentPrice = price
}
or simply
class Foo(val currentPrice: Int) {
}
You can think of the body class as the primary constructor method, as DNA said.
source
share