Chapter 5. Classes in CoffeeScript
We're going to change gears for a bit in this chapter. We've been learning details of the CoffeeScript language and putting them to work in our pet store application. In this chapter, we'll take a step back and learn about a big concept: classes. We won't be working on the pet shop application in this chapter—instead we'll use small self-contained examples to explore how classes work. We haven't forgotten about the pet shop, though, and classes will certainly come in handy when we return to it!
In this chapter, we'll learn:
What a class looks like in CoffeeScript
How to attach functions and properties to it, and how to use them
How to use inheritance to build powerful class hierarchies
How all of this translates to clean, sensible JavaScript