Introducing classes and objects
A class is a blueprint for how something should be defined. It doesn't actually contain any data—it is a template that is used to create instances as per the specifications defined in a template or a blueprint.
An object of a class is an instance that is built from a class, and that is why it is also called an instance of a class. For the rest of this chapter and this book, we will refer to object and instance synonymously. Objects in OOP are occasionally represented by physical objects such as tables, chairs, or books. On most occasions, the objects in a software program represent abstracted entities that may not be physical, such as accounts, names, addresses, and payments.
To refresh ourselves with basic concepts of classes and objects, we will define these terminologies with code examples.
Distinguishing between class attributes and instance attributes
Class attributes are defined as part of the class definition, and their...