Chapter 3: Object-Oriented Programming
Like many others, Crystal is an object-oriented language. As such, it has objects, classes, inheritance, polymorphism, and so on. This chapter will introduce you to the features of Crystal for creating classes and handling objects while guiding you through those concepts. Crystal is largely inspired by Ruby, which itself borrows a lot from the Small Talk language, which is famous for its powerful object model.
In this chapter, we will cover the following main topics:
- The concept of objects and classes
- Creating your own classes
- Working with modules
- Values and references – using structs
- Generic classes
- Exceptions