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 :

  1. Objects:-

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:-

  1. Physical objects
  2. Elements of the computer user environment
  3. Collection of data
  4. User defined data types
  5. Components in computer games
  1. Class:-

A class is a collection of similar objects. E.g. ram, sita, hari are the member of class student.

  1. Inheritance:-

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.

  1. Polymorphism:-

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 .

  1. Encapsulation:-

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 :-

  1. It emphasis in own data rather than procedure.
  2. It is based on the principles of inheritance, polymorphism, encapsulation and data abstraction.
  3. It implements programs using the objects.
  4. Data and the functions are wrapped into a single unit called class so that data is hidden and is safe from accidental alternation.
  5. Objects communicate with each other through functions.
  6. New data and functions can be easily added whenever necessary.

 



Related posts:

  1. Procedural oriented programming Procedural oriented programming (pop):- A program in a procedural language...
  2. Position and Displacement. Position of an object is its location. and Displacement is...
  3. Motion. Motion is the process of changing of position by an...
  4. What is kernel? Kernel: All the operating involving processes are controlled by a...
  5. Introduction to Set Theory The concept of modern mathematics is started with set....