Advantages of Object Oriented Programming
The following are the advantages of object oriented programming:
- The complexity of the software can be merged easily.
- The data hiding concept helps the programmer to build secure programs.
- Through class idea, we can characterize the user characterized information types.
- The inheritance idea can be utilized to dispense with the redundant code.
- OOP allows the programmer for communicating between different objects.
- By the help of inheritance concept, different classes which have combined features can be defined.
- In any time, you can easily code new data and functions.
- OOP treats data as critical element and do not allow to floe freely around the program.
- OOP ties data elements more closely to the functions that operate on.
Disadvantages of object oriented programming:
- Use of OOP is wastage of time in case of small projects or codes.
- OOP are Comparatively larger than that of other programs.
- Specifically, a big part of planning process goes into associated Object orientated Program well before one piece of code is ever written.
- Due to their size, Object Oriented Programs are slower than other programs to some extent. Other aspects of Object Oriented Programs also demand more system resources, thus slowing the program down.
Inheritance is the property that allows the reuse of an existing class to build a new class. The principle in this sort of division is that each subclass shares common properties with the class from which it is derived. For example, all vehicle in a class may share similar properties of having wheels and a motor.
The idea of classes directly points towards the idea of inheritance. The concept of classes being divided into sub-classes can be related to the activities of our daily life. We know that the class of animals can be divided into mammals, amphibians, insects, reptiles etc. A class of vehicle is divided into cars, buses and motorcycles. Inheritance is a way to form new classes. The new derived classes, inherit attributes and behavior of the previous classes, which are known as base classes. Inheritance allows different data types to share the same code, leading to reduction in code size and an increase in functionality. Objects and classes extend the concept of abstract data types by adding the notation of inheritance. Such classes inherit their behavior from the parent classes or base class. There are four different types of inheritance and they are:
- Single Inheritance
- Multi Inheritance
- Hierarchical Inheritance
- Multiple Inheritance
Encapsulation is the process that allows selective hiding data and functions in a class. All communication to an object is done via message. A message is sent to the receiver. Message define the interface to an object. Providing access to an object only through its message, while keeping the details private is called information hiding. An equivalent buzzword is encapsulation.
Encapsulation is the wrapping up of data and associated functions in a single unit in such a way so that, only essential details are exposed and rest remain hidden. Encapsulation groups all the pieces of an object into a neat package. It avoids undesired side effects of the member data when it is define out of the class and also protects the intentional misuse of important data. Encapsulation ensures that only authorized functions access the relevant data thereby maintaining against unauthorized access to ensure data safety.
Polymorphism enables the same function to behave differently according to various classes. Object oriented languages (OOL) try to make existing code easily modifiable. Polymorphism means, the same functions may act differently on various classes.
It is an important feature of OOPS. The word polymorphism is derived from the Latin word “poly” means many and “morph” means form. Polymorphism is the concept that supports the capability of an object off a class to behave differently in response to a message or action. It is a property by which the same message can be sent to objects of several different classes, and each object can respond in a different way depending on its class. It is a major feature that allows the programmer to extend the language with new data types and operations. Polymorphism expresses how to carry out different processing steps using the same function name and ability of a single operator to perform more than one.
Thank You for visiting us.
Visit again for daily updates and more tech related information.
You May Also Like: