Lecture 4.2 - Objects Everywhere (19:07)
In video quiz
13:35 / 19:46

Provide an implementation of the abstract class Nat that represents
non-negative integers.

abstract class Nat {
  def isZero: Boolean
  def predecessor: Nat
  def successor: Nat
  def + (that: Nat): Nat
  def - (that: Nat): Nat
}

Do not use standard numerical classes in this implementation. Rather,
implement a sub-object and a sub-class:

object Zero extends Nat
class Succ(n: Nat) extends Nat

One for the number zero, the other for strictly positive numbers.