Concept and Features of Oop
Concept and Features of Object-Oriented Programming
Concept of OOP
The fundamental idea behind object-oriented programming is to combine data and function into a single unit, such a unit is called an object.
Main concept of OOP are:
- Problems are divided into objects.
- It is not possible to access data freely.
- Data hiding is possible.
- It uses a bottom-up programming technique.
- Data and functions are encapsulated into a single enitity.
- In OOP, we create classes, which have the power of reusability.
Features of OOP
The main features of OOP are:
Object
An object is nothing but a self-contained component that consists of methods and properties to make data useful. It helps you determine the behavior of the class.
For example, when you send a message to an object, you are asking the object to invoke or execute one of its methods.
From a programming point of view, an object can be a data structure, a variable, or a function that has a memory location allocated. The object is designed as class hierarchies.
Class
A class is an entity that determines how an object will behave and what the object will contain. In other words, it is a blueprint or a set of instructions to build a specific type of object. It provides initial values for member variables and member functions or methods.
Inheritance
Inheritance is one of the most important aspects of Object-Oriented Programming (OOP). The key to understanding Inheritance is that it provides code re-usability. In place of writing the same code, again and again, we can simply inherit the properties of one class into the other.
Types of Inheritance
- Single Inheritance
If a child class is built from only one parent class, then this type of inheritance is single inheritance
- Multi Inheritance
If a child class is built from two or more classes, then this type of inheritance is multi inheritance
- Hierarchical Inheritance
Under this type of inheritance, the behavior of one class may be derived by more than one class
- Multiple Inheritance
Under this type of inheritance, the mechanism of deriving a class from another derived class.
Encapsulation
It is the process that allows the selective hiding of data and functions in a class. Encapsulation ensures that only authorized functions access the relevant data thereby maintaining against unauthorized access to ensure data safety.
Polymorphism
It enables the same function to behave differently in a different class. It is the concept that supports the capability of an object of a class to behave differently in response to a message or action.
Abstraction
Data abstraction is the process of identifying properties and methods related to a particular entity as relevant to the application. So, it is the process of examining all the available information about an entity to identify information that is relevant to the application. For example, in a “switch-board”, you only press certain switches according to your requirement. What is happening inside, how it is happening, you needn’t know. This is an abstraction.
Advantages of OOP
- The complexity of the software can be merged easily.
- Software maintenance cost can be reduced.
- Data access is restricted providing better data security.
- Software can be developed meeting the requirements on time, on the estimated budget.
- Data abstraction is possible.
- The inheritance concpet can be used to eliminate the redundant code.
Disadvantges of OOP
- Use of OOP is a waste of time in case of small projects ot code.
- OOP are much larger than other program.
- OOP requires a lot of time to create.
- OOP are slower than other programs, partially because of their size.
Applications of OOP
- Object-oriented database systems
- Image processing
- Pattern recognition
- Artificial Intelligence
- Computer aided teaching
- Computer games
- Internet-based applications
- Data warehouse and data mining
- Paralled computing