Exercise 42. Is-A, Has-A, Objects, and Classes
An important concept that you have to understand is the difference between a class and an object. The problem is, there is no real “difference” between a class and an object. They are actually the same thing at different points in time. I will demonstrate by a Zen koan:
What is the difference between a Fish and a Salmon?
Did that question sort of confuse you? Really sit down and think about it for a minute. I mean, a Fish and a Salmon are different but, wait, they are the same thing, right? A Salmon is a kind of Fish, so I mean it’s not different. But at the same time, because a Salmon is a particular type of Fish so it’s actually different from all other Fish. That’s what makes it a Salmon and not ...
Get Learn Ruby the Hard Way: A Simple and Idiomatic Introduction to the Imaginative World of Computational Thinking with Code, Third 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.