Basic features of object oriented programming language:
Encapsulation
Encapsulation is a concept in object oriented programming which focuses on protecting the variable and function from outside the world in order to manage the piece of code in better way and produce least impact on other part of the code.
Important points about encapsulation
- The internal details about what the object does can be hidden by using encapsulation. The problem can be solved at the implementation level itself.
- With defining a class or structure it is possible to define the accessibility of the members (methods, properties, variables) to the code outside it. Encapsulation can thus help us control the interaction between objects.
- The data of an object can be used by another object without knowing the entire data. For example, an Employee object may have name, address, company, and department as its properties. If a third party object wants to use the Employee object, it can request the name and address for the employee without needing to know the company and department details of the object.
Thus a great benefit of encapsulation is that it can change the internal implementation of a class without altering the overall system.
Abstraction
Abstraction is the process of implementing the essential features and removing unnecessary information. Abstraction is an important characteristic in which the programmer hides the irrelevant details which will in turn reduces the size of the code and the complexity of the code. Abstraction makes things more general, simpler and abstract.
Important points about Abstraction
- Abstraction makes code readable and simpler to understand. The codes are simple to understand as the complexity of the code is hidden from the user.
- The size of the code is reduced as through abstraction we do not show unnecessary codes.
- If we don’t apply abstraction to codes then it is difficult to maintain the codes.
- Through abstraction, we simplify the representation of Domain Model.
- Abstraction grouped the data of same type together and separate different type.
Inheritance
Inheritance is another main feature of object oriented programming language. Inheritance allows the class to use the property and method of other class. In other words, we can say that the sub classes derive the property and functionality from the base class. Subclass is also known as derived class and base class is known as super class.
The important points about inheritance
- Inheritance allows the developers to reuse the codes so that time and effort can be saved.
- A subclass can be treated as if it is a super class.
- It is possible to create a class of extended and exclusive functionality without having to change the functionalities and properties of the super class.
- Through inheritance the relationships among objects(of sub class and super class) can easily be established
Polymorphism
Polymorphism is way by which we are defining multiple functionalities under the same names. In other words we can say that we have the same code or operation but it will behave differently in different contexts.
Some points to remember about polymorphism
- A functionality can behave differently for different instances
- The behaviour depends on the type of data used in the operation
- Polymorphism is used for implementing inheritance.
Features of Object-Oriented Programming Languages
Reviewed by Pappy
on
August 27, 2019
Rating:
No comments: