7 Classes and subclasses to represent the world

After reading this lesson, you will be able to

  • Represent real-world elements and their interactions
  • Design class-subclass relations

Now that you know the basics of functions in Scala, you’ll learn about classes in this lesson. The concept of class is fundamental to the object-oriented paradigm, and it allows you to represent elements and interactions from the real world. Classes, subclasses, and abstract classes enable you to group entities that have common shapes and behaviors. If you are familiar with other object-oriented programming languages, you’ll find similarities with Scala’s concept of class. Table 7.1 recaps the different types of classes Scala can offer. In the capstone, you’ll use ...

Get Get Programming with Scala 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.