Summary
This chapter covered a lot of important concepts. This chapter's primary goal was to examine how OOP can be utilized to limit duplicate code and share core functionality between subclasses. Initially, we walked through a real-world example of OOP and saw how to implement setters and getters in Ruby classes. You looked at the concept of instantiation and learned the initialize method in Ruby, including its syntax, when it can be helpful to use, and various options you can pass to it in order to perform tasks such as setting default values.
We saw one of the important building blocks of OOP development: inheritance. The key to remember about inheritance is that it gives you the ability to clean up your codebase and create inherited ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access