Object Oriented Programming
In object oriented programming first the class is defined. A class contains data as well as function that operate on data. After defining a class you can create objects of class to access those data. Data can be accessed only by the object of its appropriate class. Thus data can not move freely from one function to another function.
Thus in Object Oriented Programming a program or a problem is divided in to small part known as object.
The objects of the same class communicate with each other by using member function. Following figure shows the structure of object oriented programming:
C++, JAVA are the example of Object Oriented Programming Language.
Characteristics(Features) of Object Oriented Programming:
(1) It follows bottom up approach.
(2) Primary focus is given to data rather than function.
(3) Programs are divided into small parts known as objects.
(4) Data and functions are defined inside the class so it can be accessed only by the object of the class.
(5) Objects of the same class communicate with each other using member functions.
(6) New data and function can be easily added.
What is C++
C++ is an object oriented programming language.
It was developed by bjarne stroustrup in early 1980 at AT&T bell laboratories.
Bjarne Stroustrup developed C++ by adding the feature of class so initially it was known as “C with Class”.
In 1983 it was given name C++. Because C++ is an incremented version of c it is called C++ using the concept of increment operator (++).
Benefits of Object Oriented Programming
(1) Data encapsulation benefit provided by the OOP using the concept of class to bind data and its associated functions together.
(2) Data hiding benefit provided by the OOP using the concept of public, private and protected visibility mode.
(3) The problem can be easily divided into smaller part using the concept of object.
(4) Using the concept of function overloading we can create same function with different number and type of arguments to perform different task.
(5) We can give additional meaning to the existing operator using the concept of operator overloading.
(6) Code Reusability benefit provided by the OOP using the concept of inheritance.
(7) Object of the same class communicates with each other using the concept of message passing.
(8) Complexity of the program can be easily managed using OOP.