
Object oriented programming organizes code around objects and classes acting as blueprints to create objects with properties and methods. It enables breaking programs into manageable parts and follows dry principle.
Explore abstraction in Python object oriented programming by focusing on essential attributes and concealing unnecessary details, as illustrated by examples of a mouse and a money request.
Explain inheritance in object oriented programming by showing how a class inherits methods and properties from a parent class, using a grandfather, father, and child analogy.
Explore polymorphism in Python object oriented programming, using a single function name to perform different actions based on input, illustrated by the customer care analogy.
Learn to create your first class in Python, instantiate two student objects, and set instance variables like name, age, and section to illustrate basic object oriented programming.
See how instance variables belong to a single object, while class variables share across all objects. Access class variables through the class, not via objects, to preserve the shared value.
Class Methods In Python
Learn how to use class methods as alternative constructors in Python OOP, converting a string into a student object via a from_str method, parsing name, age, and height.
Explore static methods in Python OOP using the @staticmethod decorator to define class-bound functions that don’t access self or class data, callable from class or instance.
Explore abstraction and encapsulation in Python OOP, showing essential attributes while hiding details, and learn how wrapping data inside class boundaries prevents conflicts and controls access.
Explore inheritance in Python object oriented programming, focusing on single level inheritance where a programmer class inherits from a student class to reuse methods and properties.
Multilevel inheritance in Python
If you already know Python basics, then this course is the next step in your Python learning path to becoming a Python programmer.
this course is specially made for beginners, who want to understand what is object-oriented programming in Python.
In Python, object-oriented Programming (OOPs) is a programming paradigm that uses objects and classes in programming. It aims to implement real-world entities like inheritance, polymorphisms, encapsulation, etc. in the programming. The central concept of OOPs is to bind the data and the functions that work on that together as a single unit so that no other part of the code can access this data.
Main Concepts of Object-Oriented Programming (OOPs)
Class
Objects
Polymorphism
Encapsulation
Inheritance
Data Abstraction
Class
A class is a collection of objects. A class contains the blueprints or the prototype from which the objects are being created. It is a logical entity that contains some attributes and methods.
To understand the need for creating a class let’s consider an example, let’s say you wanted to track the number of dogs that may have different attributes like breed, and age. If a list is used, the first element could represent the dog’s breed while the second could represent its age. Let’s suppose there are 100 different dogs, then how would you know which element is supposed to be which? What if you wanted to add other properties to these dogs? This lacks organization and it’s the exact need for classes.
Objects
The object is an entity that has a state and behavior associated with it. It may be any real-world object like a mouse, keyboard, chair, table, pen, etc. Integers, strings, floating-point numbers, even arrays, and dictionaries, are all objects. More specifically, any single integer or any single string is an object. The number 12 is an object, the string “Hello, world” is an object, a list is an object that can hold other objects, and so on. You’ve been using objects all along and may not even realize it.