There are two types of singleton objects:
Companion Objects
Standalone Objects
Companion Objects
A singleton object which has the same name as a class is known as the companion object of that class and the class is known as the companion class. Companion objects and classes can access each other’s private members.
Let’s define a companion object of the ChecksumAccumulator class defined in the previous lesson.