Basic concept of OOP with c++

               Object Oriented programming is a programming style that is associated with the concept of Class, Objects and various other concepts revovling around these two, like Inheritance, Polymorphism, Abstraction, Encapsulation etc.

Objects

       An object is an instance of a class. An object means anything from real world like as person, computer, bench, etc. Every object as at least one unique identity. An object is a component of a program that knows how to interact with other pieces of program. An object is the variable of the type class. 

For example, If water is class then river is object.

Class

       A class is a template that specifies the attributes and behavior of things or objects. A class is a blueprint or prototype from which objects are created. A class is the implementation of an abstract data type (ADT). It defines attributes and methods.

       Example:

                        class employee
                        {
                                  char name[10];
                                  int id;
                       public:
                                  void getdata()
                                 {
                                      cout<<"Enter name and id of employee :";
                                      cin>>name>>id;
                                  }
                        }a;

In above example class employee is created and 'a' is object of this class.Object declaration can be also done in main() function as follows:

                       int main()
                      {
                                employee a;
                      }


Data Abstraction:

       Just represent essential features without including the background details. They encapsulate all the essential properties of the objects that are to be created. The attributes are sometimes called 'Data members' because they hold information. The functions that operate on these data are sometimes called 'methods' or 'member functions'.

 It is used to implement in class to provide data security.

Encapsulation:

               Wrapping up of a data and function into single unit is know as encapsulation. In c++ the data is not accessible to the outside world. Only those functions can access it which is wrapped together within single unit.

                                      
Inheritance:  

              Inheritance is the process, by which class can acquire the properties and methods of another class.The mechanism of deriving a new class from an old class is called inheritance. The new class is called derived class and old class is called base class. The derived class may have all the features of the base class. 


For example, Student is base class and Result is derived class.

Polymorphism:   

             A Greek word Polymorphism means the ability to take more than one form. Polymorphism allows a single name to be used for more than one related purpose. The concept of polymorphism is characterized by the idea of  'one interface, multiple methods'. This means using a generic interface for a group of related activities.

Example:
int total(int, int);
int total(int, int, float);