How To | Programming | Python
Intro to Object-oriented Programming in Python
OOP from the ground up with Examples from Pikachu and Bay Area Rapid Transit (BART)
What is Object-oriented Programming?
Object-oriented Programming (OOP), is a programming paradigm that provides a means of structuring programs so that properties and behaviors are bundled together as individual objects. These objects contain data, in the form of fields (attributes), and code, in the form of procedures (methods).
Programming paradigms are a way to classify programming languages based on their features. Languages can be classified into multiple paradigms.
Classes vs Objects (Instances)
When executing OOP with Python, each object is an instance of some class.
Think of a class as a blueprint for how an object may operate. The object is a particular instance derived from the class.
For example, an object could represent a particular person with attributes including name, age, address, etc., and methods like walking, talking, breathing, and running. The class would cover people in general.