Object Oriented Programming in Python
Python is a multi-paradigm language, which simply means that it follows multiple paradigms (or approaches), and Object Oriented Programming (Often said as OOPs) is one of the paradigms. We are now going to explore Object-oriented programming in Python.
If you are already familiar with some other language that follows the Object-oriented programming paradigm, it would be quite easy for you to get going with the concept, but still, we have not assumed anything, so we are going to consider things from scratch here. Here is an insight into what are we going to cover here –
Object Oriented Programming in Python
- What is Object Oriented Programming?
- Classes and objects
- Creating a class
- Creating an object of a class
- Constructor
- Types of constructors
- Default constructor
- Non-parameterized constructor.
- Parameterized
- Principles of OOP
- Abstraction
- Encapsulation
- Inheritance
- Types of inheritance
- Single Inheritance.
- Multilevel Inheritance.
- Multiple Inheritance.
- Hierarchical Inheritance.
- Hybrid Inheritance.
- Polymorphism
- Duck typing
- Operator Overloading
- Method Overloading.
- Method Overriding.
- What if you want to call the superclass method?
- Which superclass method will be called in case of Multiple inheritances?
- Types of inheritance
- Types of constructors
- Classes and objects
- access modifiers
- The public access modifier
- The protected access modifier
- The private access modifier
- Accessing the private variables and the private methods
What is Object Oriented Programming?
Object Oriented Programming is one of the very popular approaches to solving programming problems. Here, we are going to be dealing with objects. The thing is that we would get to learn about so many terms here, like classes, objects, attributes, and behaviors, and then the principles of Object Oriented Programming, like inheritance, polymorphism, abstraction, and encapsulation, and we are going to consider these principles as well.
To understand from the very start, what is object-oriented programming, we can consider an example. If you look around yourself, you can find many different objects, which are having different properties. For example, a mobile phone, earphones, keyboard, monitor, cup, bottle, key, desk, or anything is an object, and it has certain properties.
We are soon going to consider many different concepts, which would let us get started and get going with the different concepts of object-oriented programming.