March 2012
Intermediate to advanced
384 pages
8h 36m
English
Topics in This Chapter ![]()
• 6.2 Companion Objects — page 66
• 6.3 Objects Extending a Class or Trait — page 67
• 6.4 The apply Method — page 67
• 6.5 Application Objects — page 68
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 ...
Read now
Unlock full access