Chapter 5. Classes

Topics in This Chapter A1

In this chapter, you will learn how to implement classes in Scala. If you know classes in Java, Python, or C++, you won’t find this difficult, and you will enjoy the much more concise notation of Scala.

The key points of this chapter are:

  • An accessor method with no parameters does not need parentheses.

  • Fields in classes automatically come with getters and setters.

  • You can replace a field with a custom getter/setter without changing the client of a class—that is the “uniform ...

Get Scala for the Impatient, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.