Вы находитесь на странице: 1из 3

Ammas

C++ - A Revisiting
C++ is Object Oriented Programming Language
Its application domains include systems software, application software, device drivers, embedded
software, high-performance server and client applications, and entertainment software such as video
games.
Procedure-Oriented Programming
o In this approach, the problem is viewed as a sequence of things to be done such as reading,
calculating and printing. A number of functions are written to accomplish these tasks.
o The primary focus is on functions.
o Very little attention is given to the data that are being used by various functions.
o For large program it is very difficult to identify what data is used by which function.
o E.g. of languages which follow this is approach : COBOL, FORTRAN and C
Characteristics of Procedure-Oriented Programming:
o Importance is on doing things(algorithms)
o Large programs are divided into smaller programs known as functions
o Employs top-down approach in program design
o Functions share global data

Object-Oriented Programming
o Def: It s an approach that provides a way of modularizing programs by creating partitioned
memory area for both data and functions that can be used as templates for creating copies
of such modules on demand. (Object is considered to be partitioned area of computer
memory)
o It ties data more closely to the functions that operate on it and protect from unauthentic
modifications by outside functions.
o Decomposition of problem into a number of entities called Objects.
Characteristics of Object-Oriented Programming:
o Importance is on data rather than procedure.
o Programs are divided into what are known as objects.
o Data is hidden and cannot be accessed by external functions
o Employees bottom-up approach in program design.
Basic Concepts of OBJECT- ORIENTED PROGRAMMING
Object
o It is a real world entity. ( basic run-time entity)
o It may represent a person, student, a bank account etc
o Classes define types of data structures and the functions that operate on those data
structures. Instances of these data types are known as objects and can contain
member variables, constants, member functions
Classes
o Its a user defined data type
o The entire set of data and code of an object can be made a user-defined data type with
the help of class.

Data Encapsulation
o The wrapping up of data and function into a single unit (called class) is known as
encapsulation. Data and encapsulation is the most striking feature of a class.
o Data is accessible through member functions in the class and does not provide direct
access to the data from the outside world. This insulation of the data from direct access
by the program is called data hiding or information hiding.
o Real world example of data encapsulation:
A car consists of wheels, steering, engine, etc. but together it is considered as a one unit
called Car.

Data Abstraction
o Abstraction refers to the act of representing essential features without including the
background details or explanation.
o Real world example :
When a person is pressing on the switch, the light gets ON but the he is unaware of the
phenomenon that takes place at the background. (i.e. showing essential features without
representing background actions)
Inheritance
o Inheritance is the process by which objects of one class acquired the properties of objects
of another classes.
o This provides the idea of reusability. This is possible by deriving a new class from the
existing one

o Real world example :

Properties of an object of a class Human will be acquired by object of classes like Student, Teacher and
Farmer. Each class gets properties of its parent class Human and also includes its own properties.

Polymorphism
o Polymorphism means ability to take more than one form, i.e. an operation can exhibit
different behaviour at different instance depend upon the data passed in the operation
the real life example
o Real world example :
Some water purifiers can produce the pure water in hot, cold and normal form.
The form of the water produced is determined by the option selected by the
user. (i.e. Same machine but different behaviours on different inputs) .

Two types :
Compile time polymorphism
Eg:
Operator overloading
The process of making an operator to exhibit different behaviors in
different instances is known as operator overloading.
Function overloading
Using a single function name to perform different type of task is known as
function overloading.

Run Polymorphism
Eg: Virtual Functions.
Dynamic Binding
Dynamic binding means that the code associated with a given procedure call is not known until
the time of the call at run time.
Message Passing
Objects communicate with one another by sending and receiving information


1. Object-based programming languages
o Supports encapsulation and object identity.
Major feature that are required for object based programming are:
Data encapsulation
Data hiding and access mechanisms
Automatic initialization and clear-up of objects
Operator overloading
o They do not support inheritance and dynamic binding.
o Ada is a typical object-based programming language.
2. Object-oriented programming language
o It incorporates all of object-based programming features along with two additional features, namely,
inheritance and dynamic binding.
Object-based features + inheritance + dynamic binding

Вам также может понравиться