Data abstraction:
  • Abstraction refers to give the general view.
  • We represent thing without going into the background details.
  • Class contains abstract data members such as size, weight, height and function to operate on it.
Data Encapsulation & Data hiding:

“Wrapping up (packing) of data and functions into a single unit-class is known as the data encapsulation.”

  • Data encapsulation provides security on data.
  • The data members cannot be accessed outside class in which it is declared.
  • This fundamental concept is known as the data hiding.
  • C++ provides the facility of data hiding by the way of public or private member variable.
  • Private member variable can’t be accessed outside the class while public member can be accessed from anywhere.
  • Inheritance is the process by which one class inherits the properties and method of another class. This is based on the hierarchical classification.
  • For example, we can categories the ‘animal’ into two categories: ‘wild animal’ and ‘pet animal’. Also we can categories ‘wild animal’ into ‘tiger’, ‘lion’, ‘leopard’ and ‘pet animal’ into ‘cat’, ‘dog’, ‘bull’.
  • Inheritance provides the facility of re-usability.
  • Here we can add new features (new data and function) into existing class without modifying it. This is done by deriving new class (subclass or child class) from existing class (super class or parent class). The sub class contains the facility of super class as well as its own features.
inheritance example
  • Polymorphism is a Greek work and its mean is to take more than one form. An operations show different behavior in different condition.
  • The behavior is used on the data type of variable and number of arguments.
  • For example following function calls are different in terms of number of arguments.
sum(int a, int b, int c)
sum(int a, int b)
  • The above fundamental is known as the function overloading.
  • Similar way we can perform operator overloading in which one operator is used for multiple operation.
  • For example ‘+’ is a operator that is used for arithmetic operation the same operator we can use for the concatenation of string and add two structure elements.
  • In general form we can define the polymorphism as: “One Interface, multiple forms (methods).”
Dynamic binding:
  • Binding means linking of two functions.
  • There are two types of binding technique: one is compile time binding in which linking is performed during the time of compilation.
  • It is also known as early binding.
  • Another technique of binding is dynamic binding in which linking of function is performed during the execution when function is called.
  • It is also known as the late binding. Dynamic binding provides the facility of the polymorphism.
Message passing:
  • Message passing is important technique for communication between objects.
  • When two objects want to be communicate i.e. we have to send the message from one object two another objects we are use some special method and that method is known as interface.
message passing

                                   Message Passing Interface

Benefits of OOP:

  1. Through inheritance we can save code and use existing class. And by this way we can save time.
  2. Data hiding provides the security of our data and data can’t be accessed accidentally or avoid misuse of it.
  3. We can create multiple objects from one class.
  4. We can match the problem in real world with the program.
  5. We can divide the work into multiple modules based on object.
  6. We can easily upgrade our system from small to large one.
  7. Software complexity is reduced.
  8. It is easy to develop the system for the programmer.

Types of Object-Oriented Language

  • All object-oriented programming language does not support all the features provided by the Object oriented programming technique.
  • Generally every object-oriented programming language provides the facility of data encapsulation and class.
  • On the basis of features provided by the Language we can categories the language into two sections:
  1. Object-based programming language:

  • Object-based programming language supports mostly data encapsulation, data hiding, automatic initialization, operator overloading.
  • But it doesn’t provide the facility of inheritance and dynamic binding. Ada is example of object-based programming language
  1. Object-oriented programming language:

  • Object-oriented programming language provides all the features provided by the object-based programming language such as data encapsulation, data hiding, automatic initialization, operator overloading.
  • Also it is provides the facility of inheritance and dynamic biding which is not provided by the object-based programming language.
  • C++, Java, C# etc. are the object-oriented programming language.