19.2 Classes
Objects are created via classes. A class is a formal description of the structure of an object, which states what attributes and methods it has.
Using a class alone doesn’t make much sense, however: It only represents the description of an object type; it is not an object itself.[ 89 ] You can compare the relationship between a class and object with that between a baking recipe and a cake. The recipe defines the ingredients and the manufacturing process of a cake and thus its characteristics. Nevertheless, a recipe alone is not enough to invite relatives to share a delicious cake on a Sunday afternoon. Only during the baking process does the abstract description become a finished cake.
Another name for an object is an instance ...
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