Why OOP?
Before learning anything we should always find the answer of "Why is this useful/Why are we learning this?". So before knowing what is OOP we are going to know why we are even talking about this.
In the physical world we need to create products which are similar to eachother. The products may have the same functionalities but probably with a little different specifications. As we need to use the same base product everytime we work smartly. We make a base skeleton of the products with the similar functionalities and add the specifications later on while creating a particular object. Let's understand this with an example: Suppose you want to build your own house. So what would you do first? You'll hire an architect to make a blueprint of your house. This blueprint is the class which can be called " House" class. This "House" will/may have windows,doors,rooms,balconies and many more things. All of these features are the functionalities of the house. The blueprint of your house can be used by anyone for building their own house. All of the houses which have been built or will be built are "Objects".
What is OOP?
Just like the physical world we need to create many objects with the same functionalities in the virtual world also. So we create a virtual skeleton for that purpose. This is similar to the Resume templates we use to make our own Resumes.In programming languages we use and create many classes and objects to build virtual products. For example: Suppose we are building an "Animal Planet" comouter game which has multiple animals and they all speak different words. In this case "Animal" will be the class and different animals like Dog,Duck and Cat will be the objects. All of them have the "speak" functionality but they speak "Woof"," Quack" and "Meaw correspondingly. In computer programming all of these together(classes, objects, methods etc.) are called Object Oriented Programming. The functionalities are called " methods" in OOP.
Top comments (0)