OOP or Object Oriented Programming is an important topic we need to study whenever we get into or are into coding. Be it interviews, exams, or contests and competitions. OOP's will always be there.
Today in my blog, I'll be explaining some essential terms and concepts that we come across in OOP. All this is presented without any code or technical terms. So, even if you don't know any language or are just a beginner, you can still read and enjoy the blog.
To start with, we have a concept called:
Inheritance - A child always has a few characteristics of his/her parents. And we often see people saying the guy looks like his father or has a nose like his mother.
Inheritance lets us use some properties already defined, thus facilitating reusability.Polymorphism - It means one can have many forms at the same time. Look around you and see a man. Now, that man can be a father, a husband, a son all at the same time.
Another way to understand it is to look at yourself. Suppose you are in a classroom, you are a student to your teacher, a customer to the manager at the market, a son/daughter to your parents.Abstraction - It is more like you don't need to know the underlying cause or the implementation method.
To take an example, assume you move the gear handle in your car or press on the brakes. Immediately you'll see some changes in your driving experience. While doing so, you don't need to know what is happening inside the cars, causing the breaks to stop the vehicle.-
Encapsulation - Meaning data hiding and security. A straightforward example to understand it take out a capsule from your medicine shelf. Now observe it. You see a top layer inside which there is a mixture of 2-3 medicine powders. Now the top layer is hiding the inside medicines. This is what is called encapsulation.
Another example is your smartphone. There are a lot of mini parts all embodied into one single outer body.In simple words, we can also define it as bringing different things inside one.
Object and Class - This is very simple to explain and understand. Think about human beings, Human Being is a class and "Man" is an object of Human Being similarly "Women" is an object of Human Being class.
This is all for this blog.
If it helped you understand the concepts better you can buy me a coffee for the encouragement at : https://www.buymeacoffee.com/ayushagarwal24.
Lastly, Your support keeps me going, and I give my 100 percent to these blogs! If you've found value, consider fueling the blog with a coffee ☕️ donation at the below link.
Thank you! 🙏
Top comments (2)
That is misleading. It should be that a
Person
is the class, and each of the students are objects. ARoom
is the class, and each classroom is an object.Thanks for pointing it out. I'll change it with another example.