What Is Object-Oriented Programming?
- Object-Oriented Programming (OOP): Focuses on objects and message passing between them rather than just variables and functions.
- Classes and Objects:
- Class: Blueprint for creating objects. Defines instance variables and methods.
- Object: Instance of a class.
A class specifies the set of instance variables and methods that are “bundled together” for defining a type of object. A class, therefore, is a “cookie cutter” that can be used to make as many object instances of that type as needed. For example, strings in Python are object instances of the built-in String class

One method of the String class is isdigit
. Thus, every string object has this method. The specific object whose isdigit
method is called determines the specific string that it is applied to:
name.isdigit()
➝ Falsecity_state.isdigit()
➝ Falseaddress.isdigit()
➝ Falsezip_code.isdigit()
➝ True
Message passing
Message passing occurs when a method of one object calls a method of another.
For example, if Object B were a list and B1 a sorting method, then a call to B1 is a message (or request) for it to become sorted.

A message to one object can result in the propagation of messages among many other objects in order to accomplish a request.