Chapter 6. Objects
Topics in This Chapter
In this short chapter, you will learn when to use the
object construct in Scala. Use it when you need a class with a single instance, or when you want to find a home for miscellaneous values or functions.
The key points of this chapter are:
• Use objects for singletons and utility methods.
• A class can have a companion object with the same name.
• Objects can extend classes ...