Object oriented programming
Object oriented programming :
The main idea behind object oriented approach is to combine process (function) and data into a unit called an object. Hence, it focuses on objects rather than procedure.
Characteristics of Object Oriented Programming :
Any physical or logical units having specific characteristics which match to the real word are called as object.
Object oriented approach views a problem in terms of objects rather than procedure for doing it.
Objects can be classified below:-
- Physical objects
- Elements of the computer user environment
- Collection of data
- User defined data types
- Components in computer games
A class is a collection of similar objects. E.g. ram, sita, hari are the member of class student.
Inheritance is the capability of one class to inherit the properties from another class. The child or derived class inherits the characteristics of base or parent class. The child class not only inherits the properties from the base but also have some additional property of its own.
The original class is called bas class and the classes which share its characteristics are called derived class.
Importance of inheritance in Object Oriented Programming :-
In Object Oriented Programming , the concept of inheritance provides an important extension to the idea of re usability. A programmer can take an existing class and without modifying it, add additional features and capabilities to it. This is done by deriving a new class from the existing one. The new class will inherit the capabilities of the old one but also have some additional features of its own.
Th word polymorphism is derived from Greek word polymorphism where poly means many and morph means form.
Polymorphism means the ability to take more than one form. It allows different objects to respond to the same message in different ways. It is the ability for a message or data to be processed in more than one form. The same operation is performed differently depending upon the data type it is working upon.
E.g. Consider the operation of addition for two numbers; the operation will generate a sum. If the operands are strings, then the operation would produce a third string by concatenation. Overloading is a kind of polymorphism. It is also an important feature of Object Oriented Programming .
It is the way of wrapping both data and functions under a single unit called class. This prevents the data from accidental alternations. It means that data is hidden so that it can’t be accessed mistakenly by functions outside the class.
Features / advantages of Object Oriented Programming :-
- It emphasis in own data rather than procedure.
- It is based on the principles of inheritance, polymorphism, encapsulation and data abstraction.
- It implements programs using the objects.
- Data and the functions are wrapped into a single unit called class so that data is hidden and is safe from accidental alternation.
- Objects communicate with each other through functions.
- New data and functions can be easily added whenever necessary.
- Procedural oriented programming Procedural oriented programming (pop):- A program in a procedural language...
- Position and Displacement. Position of an object is its location. and Displacement is...
- Motion. Motion is the process of changing of position by an...
- What is kernel? Kernel: All the operating involving processes are controlled by a...
- Introduction to Set Theory The concept of modern mathematics is started with set....