Object Oriented Programming language acronym as OOPs which is organized around “objects” rather than “actions” and “data” rather than “logic”. Before object oriented, program has been viewed as a logical procedure that take long process to do any task. Main purpose it serve is to reuse and recycle the code. Provide clear module structure with clearly define interface. A programmer can easily maintain the code and manipulate because new objects are created with minor changes in existing one. Implementation based on real life scenarios.
Classes are very useful in programming or we can say class is a blueprint for objects. Purpose serve by class is to specify the form of an object and manipulate data into one package. The data and functions of any class are called as members of the class. Let take an example to clear the concept of classes. Rather than using a class of 100 different persons what we can do is use a class of single person and make other as the object so that you can instantiate it into class.
An object is a component which contain properties and methods to make data useful of any type. Object Properties determine what it knows and methods tells what it can do. We can relate objects with real world also example your desk, your bicycle etc. Objects characteristics are: Bicycle Properties (gear, pedal, speed) and behaviour (Applying breaks, changing gear, changing pedal) this is all about real world now we talk in the computer science world in which object is a location in memory which contain value and referenced by an identifier. It can be a variable, data structure or any function. In other words we can define object as a instance of a class. Object serve purpose to reuse the code.
The features which make language as object-oriented are the Pillars of OOPs. Object Oriented language have 4 pillars.
Now we are going to dicuss them briefly.
Inheritance is one of the important concept in object-oriented programming. It allow easily to define a class in terms of another class which makes it easier to create and maintain any application. Advantage of using this concept is code reusability and fast implementation time.It inherit the properties of existing class rather than rewrite again all the same data members and function again. Existing class is called a base class and the class which inherit the properties of existing class is called derived class. It implements IS-A relation like Dog IS-A animal.
As a name implies Polymorphism means “many forms”. It is an ability of any object to take many form. Commonly used when any parent class reference is used to refer to a child class object. Any object that can pass more than one IS-A relation is considered as polymorphic. It process objects differently depending on the object’s data types or class from which they belong. It redefine the methods for the derived class. Lets take an example to clear the concept of polymorphism. Take a base class shape an programmer has to define the areamethods() for derived class as circles, rectangles and triangles. Whatever the shape of any object, applying areamethods() will return the correct results.
The primary goal which Abstraction serve is to managing the complexity of the large programs by hiding the irrelevant details from the user. Remember abstraction is focusing on necessary details. It is one of the pillars of Object Oriented Programming (OOP). Basically its focus on the necessary aspects and take out the unnecessary details from the system under consideration. Let take an example to clear the concept of abstraction. You as a person play different role in real world like student in school, Employee at you work place and citizen at you government institution. So if someone will model the payroll system then it look as Employee (PRN, Full Time/Part time, Designation) and as for the other two. So, these aspects show the relevant details which is called abstraction.
Encapsulation is all about hiding details from the outside world and proving a decent interface for the entities of the outer world to interact with object. The concept of binding the data that the function that manipulates data and keep both safe from outside interference and misuse is called Encapsulation. Lets take an example to clear the concept of Encapsulation. If someone ask my name then he cannot access my brain cell rather he ask to me directly another example is: if a driver wants to speed a car then there are interface like accelerator pedal, gear and so on for that to be done.
First Object oriented programming language came into existence is SIMULA. As name implies it was designed for doing simulation. Language use in wide range of application such as VLSI design, process modelling, type testing, computer graphics and education.