There are 4 basic concepts in Object-Oriented Programming(OOP) :
1.Inheritance => Here, the object acquires or shows all the properties and behaviors of the parent Object. So, it will be easy to reuse code as well as it will be easy to understand the principle. For example just thing of it as a human you will be resembling the features physically and logically like your parents. That's how this works.
2.Encapsulation => This one is actually binding up codes and data together, that is binding up methods/functions with data(variables) together. Consider it like a capsule in which medicine are mixed together where we can't see anything. This is protecting the function happening in back from the site of the user. This function is simply known as Data hiding.
3.Abstraction => This is what doing that hiding thing like I mentioned earlier. So user can't find how the function is working. and this distinguishes between different objects. It classifies objects into concepts and focuses on common properties.
4.Polymorphism => Here, one functions/task is performed in different ways. For example, When we take a shape class with data of radius, length, and width; we can find the area of rectangle, circle and square with different functions.
- In Object Oriented Programming, properties are also called as attributes, and data members. These are actually the variables we create.
- And functions are called as methods, behaviors and member functions.
No comments:
Post a Comment