C, Pascal, FORtran are procedural language in which each statement tells the computer to do something like, get some input from the user and calculate or process that input and get the desired result [ add/divide/difference/multiple of any two numbers ].
Therefore, a program in the procedural language is a list instruction which is suitable for small programs.
The program may become larger and complex difficult to manage, so it is necessary of breaking down the program into smaller units. So for this reason the function is adopted, the function in different languages called subroutine, module, subprogram or it may be called a procedure.
There the procedural program is divided into functions and the idea of breaking a program into function can be further extended by grouping a number of functions together into a larger entity called as module. Dividing a program into smaller function and module is one of the core concept of the structured programming..
“Divide and Conquer”
Object-oriented programming (OOP) is a programming language model organized around objects rather than “actions” and data rather than logic.
Historically, a program has been viewed as a logical procedure that takes input data, processes it, and produces output data.
OOPs has lots of features and characteristics the list is given,
An abstraction denotes the essential characteristics of an object that distinguish it from all other kinds of object and thus provide crisply defined conceptual boundaries, relative to the perspective of the viewer.
Focuses on the outside view of an object and so serves to separate an object’s essential behavior from its implementation. It is the important concept if including encapsulation, inheritance and polymorphism.
The polymorphism came from “Greek” word ‘poly’ and ‘morphs’ where poly means ‘many’ and morphs means ‘forms’. In OOP is the flow of a message in many forms it allows different objects to respond to the same message in different forms for example Date of Birth.
It is the form of re-usability in which new classes are created from the existing classes by absorbing their behaviour and attributes and adding some of the new functionalists by themselves. The base class inherit attributes from the parent class. Inheritance supports hierarchical classification there are two types of hierarchy.
- is-a: is-a relationship exist between two component or concept when the first is the specialized instance of the second i.e dog is a mammal.
- has-a: It exist when second component or concept is the part of the first one i.e car has an engine.
It is a mechanism to hide the data from unauthorized access. That binds data and code together. IT manipulates and keeps both safe from outside interference and misuse. The date is visible to the particular person or authorized person not to all.
Overloading is the process of defining same method in multiple times, so then you can call with different argument. When an existing operator, such as + or = , is given the capability to operate on a new data type, it is said to be overloaded.
Overloaded methods are generally used when they conceptually execute the same task but with a slightly different set of parameters. The original method get called as the compile time and that helps to resolve the complexity of the program and code clarity, avoid errors and faster execution.
int a(int s),
double a(double r, int h),
long a(long l, int b, int h)
Overriding is the processing defining a function in the derived class with the same name as in the parent class is called overriding.
The overridden method or function should have the same name, signature, and parameters as the one in its parent class. In C++, the base class member can be overridden by the derived class function with the same signature as the base class function.
Method overriding is used to provide different implementations of a function so that a more specific behavior can be realized.
Dynamic Binding known as linking a procedure call to the code that will be executed only at run time, It means that the code to be executed for a specific procedure call is not known until run-time. Dynamic binding is also known as late binding or run-time binding.
A class is a logical method to organize date and functions to the same structure. Ii is a blueprint or prototype that defines the attributes and methods common to all the objects. The class is the way to bind the data and its associated functions together. It allows data to be hidden if necessary from external use.
The object is a bundle of the software of data or attributes and related functions. It is often called as the instance of the class.
The interaction among objects in between functions not the data. The interaction between the objects is possible through message passing i.e communicate using message. Object interact with each other using message.
Object Oriented Approach
The idea behind object-oriented language is to combine both data and functions in a single unit. Such unit is known as an object.
Where as object functions are known as member functions and object data is known as data members. If you want to read a data item in an object then you will call a member function on that object. It will access the data and return the value to you.
Data and functions are said to be encapsulated into a single entity. Data are hidden , which means that there you can’t access the data directly. If you want to modify the data of an object you need to know which function interact with it.
The C++ program typically consists no of objects which communicate with each other by calling one another member function. Calling an object’s member function referred to as sending the message to the object.