Core concept

class Point(val x: Int, val y: Int) {
  def dist(other: Point): Double = ???
}
Advertisement

How it works

Auxiliary constructors via this(). Case class often simpler.

Advertisement

Trade-offs + gotchas

OOP-heavy code. Mutation-holding types.