Concepts of OOPs

Some basic concepts are used in OOPs are given as follows :

  • Objects
  • Classes
  • Inheritance
  • Data Abstraction & Encapsulation
  • Polymorphism
  • Dynamic Binding
  • Message Passing
  • 1. Objects : Objects are the basic run-time entities in object oriented programming. It represents like a person or a table of data that handles the program. It may also represent user-defined data such as vectors and lists. When a program is executed, the objects interact by sending messages to one another.
    object
    2. Classes : Classes are user-defined data type. The entire set of data of code and it’s object can be made a user defined data types that is called class. A class is a collection of objects user-defined data type. It has the following syntax :

    class classname
    
    Example :
    #include<iostream>
    using namespace std;
    class test{
          - - - - - - - - - - 
          - - - - - - - - - - 
          - - - - - - - - - -
    };
    

    3. Inheritance : Inheritance is a process by which of one class acquire the properties of objects of another class. In OOPs, the concept of inheritance provides the idea of re-usability that means we can add additional features to an existing class without modifying it. It is possible to derive a new class from the existing class. The new class will have the combined features of both the classes. The mechanism of inheritance is that it allows the programmer to reuse a class that is almost.

    4. Data Abstraction & Encapsulation : Abstraction refers to the act of representing essential features without including the background details or explanations. Abstraction are defined as a list of abstract attributes such as size, weight and cost and functions to operate on these attributes.
    The wrapping up of data and functions into a single unit that is called encapsulation. Encapsulation is the most striking feature of a class. The data is not accessible to the outside world and only those functions which are wrapped in the class can access it.

    4. Polymorphism : Polymorphism is s Greek term that means the ability to take more than one form. Polymorphism is an important concept of OOPs. Polymorphism plays an important role in allowing objects having different internal structure to share the same external interface that means a general class of operations may be accessed in the same manner even though specific actions associated with each operation.

    5. Dynamic Binding : Binding means linking of a procedure call to the code to be executed in response to the call. Dynamic Binding means that the code associated with a given procedure call is not known until the time of the call at run-time. Dynamic Binding is also called late binding.

    6. Message Passing : An object-oriented program consists of a set of objects that communicate with each other.Objects communicate with one another by sending and receiving information much the same way as people pass messages to one another, this concept is called Message Passing.
    A message for an object is a request for execution of a procedure and there will invoke a function in the receiving object that generates the desired result.
    msg