Understand what is Object-Oriented Programming (OOP’s) concepts.
Before we start let's discuss the scope of this article.
Intended readers — who are starting or started the programming.
Takeaway — After reading you will have an understanding of Object-Oriented programming.
Prerequisite — Nothing as such but understanding of memes can help you to enjoy & relate more while reading.
So, let's begin and conqueror this concept.
1. what is an Object?
As the name suggests Object-Oriented. so first let’s see what is an object and how does it look.
In the Image Below, everything you see is an Object.
Yeah, Man !! … I am looking into it. but are you telling me these Table, chair, fan, Tv, sofa, door are Objects?
YES !!! they are objects.
Let's see how they are object and how it is related to programming?
Consider you own a car, and if people ask you about it
“can you please tell me something about your car?”
then you can tell them -
- Brand of your car.
- Model of your car.
- Color of your car.
- fuel type — Diesel/petrol /CNG/Battery.
…..and many more
so whatever things mentioned above will be considered as Feature/properties/attribute of Your car.
so you are describing a car by some sorts of properties it has like model, colors, etc.
That's what is exactly OOP’s is all about.
you take a thing/object and define it using its properties.
For furniture( table/chair) it can be dimensions and materials used, price, etc… can be featured.
Likewise in OOP’s we consider everything as an object and define it using its properties and features.
So now we are clear what is an Object.
But in real-world objects might be related to some other object too. that's exactly where OOP’s offer great power and flexibility to programmers. so let's look up the features of OOP’s.
Features of OOP’s
Just like when we say Avengers (pic above) we don't refer to a particular superhero ...instead, we are referring all as one unit.
That's what OOP’s has to offer with Encapsulation. when we are referring to something as an object then automatically we included all its properties and features and we need not specify the particular property of the object. and the place where we define all the properties and attributes of an object is known as Class.
let say you are reading this blog from your device let say your mobile or laptop. all you wanted is a blog and you landed on this page. you are least bother about how it reached you over the internet what technology in the background brought this blog for you.
in simple words-
what I wanted, did I got that? How I got that I don't care.
so OOP’s offer this flexibility for the end-user(who is using the service).
End-user doesn’t need to know HOW IT IS WORKING?
all they care about is it working?
so Engineers hide their implementation details (business logic)from users which provides security to the business at the same time end-user get a simplified and smooth user experience.
So that's what polymorphism means “poly” means many and “morphs” means form. The one with many forms.
So polymorphism helps to utilize the same thing to behave differently as per need.
In OOP’s it is achieved by — 1) Overloading 2) Overriding
and will be discussed in advanced upcoming blogs. so that you come back again to my channel-
In inheritance in oop’s there is a parent-child relationship.
child by default will have the functionality of their parents. and further functionality specific to a child can also be defined apart from what it Inherited from its parents or if required the functionality it inherited can be modified/override as well and this is called overriding.
Hope you got a basic understanding of OOP’s and an advanced in-depth blog with code snippets will be posted soon.
till then Goodbye!!