0% found this document useful (0 votes)
2 views6 pages

Overview of OOPS

The document provides an overview of Object Oriented Programming (OOP), highlighting its need, characteristics, and advantages over traditional Procedural Oriented Programming (POP). It explains key concepts such as objects, classes, encapsulation, inheritance, and polymorphism, emphasizing the importance of data organization and security. Additionally, it outlines various applications of OOP in fields like real-time systems, artificial intelligence, and simulation modeling.

Uploaded by

Royal Computers
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views6 pages

Overview of OOPS

The document provides an overview of Object Oriented Programming (OOP), highlighting its need, characteristics, and advantages over traditional Procedural Oriented Programming (POP). It explains key concepts such as objects, classes, encapsulation, inheritance, and polymorphism, emphasizing the importance of data organization and security. Additionally, it outlines various applications of OOP in fields like real-time systems, artificial intelligence, and simulation modeling.

Uploaded by

Royal Computers
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 6

UNIT – 1 AN OVERVIEW OF OBJECT ORIENTED PROGRAMMING

NEED OF OPP
OPP is an approach to program organization and development that attempts to
eliminate some of the pitfalls of conventional programming methods by incorporating the
best of structured programming features with several powerful new concepts. It is a new way
of organizing and developing programs and has nothing to do with any particular language.

PROCEDURAL LANGUAGE (POP)


In this method 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 them. The
primary focus is on function.
Procedure oriented programming basically consist of writing a list of instructions (or actions)
for the computer to follow and organizing these instructions into groups known as functions.
We normally use a flowchart to organize these actions and represent the flow of control from
one action to another. We concentrate on the development of function.

CHARACTERISTICS OF POP
1. Emphasis is on doing things (algorithm)
2. Large programs are divided into smaller programs known as functions.
3. Most of the function share global data.
4. Data move openly around the system from function to function.
5. Function transform data from one form to another.
6. Employs top-down approach in program design.

THE OBJECT ORIENTED APPROACH


OOP treats data as a critical element in the program development and does not allow
it to flow freely around the system.
OOP allow to decomposition of a problem into a number of entities called objects and
then builds data and functions around these objects.

FEATURES OF OOP
1. Emphasis is on data rather than procedure.
2. Programs are divided into objects
3. Data structures are designed such that they characterize the objects.
4. Functions that operate on the data of an object are tied together in data structure.
5. Data is hidden and cannot be accessed by external functions.
6. Objects may communicate with each other through functions.
7. New data and functions can be easily added whenever necessary.
8. Follows bottom up approach in program design.

Definition of OPP :- It is an approach that provides a way of modularizing program by


creating partitioned memory area for both data and functions that can be used to templates for
creating copies of such modules on demand.

CHARACTERISTICS OF OOPS
OBJECTS
Objects are the basic runtime entities in an object oriented system. they may represent
a person, a place, a bank account, a table of data or any item that the program has to handle.
They may also represent user defined data such as vectors, time and lists. Objects take up
space in the memory and have an associated address.
When a program is executed, the object interact by sending message to one another.
For e.g. if “customer” and “account” are two object in a program, then the customer object
may sent a message to the account object requesting for the bank balance. Each object
contains data and code to manipulate the data. Objects can interact without having to know
details of each other’s data or code. It is sufficient to know the type of message accepted and
the type of response return by the objects.

CLASSES
The entire set of data and code of an object can be made a user defined data type with
the help of a class. In facts, objects are variables of the type class. Once a class has been
defined, we can create any number of objects belonging to that class. Each object is
associated with the data of type class with which they are created. A class thus is a collection
of objects of similar type.
For e.g. mango, apple and orange are the members of class fruit. Classes are user defined data
type and behaves like the built in types of a programming language.
If fruit has been defined as a class, then the statement
Fruit mango;
Will create an object mango belonging to class fruit.

DATA ABSTRACTION AND ENCAPSULATION


The wrapping up of data and functions into a single unit (called class) is known as
encapsulation. Data encapsulation is the most striking feature of a class.
Only those functions which are wrapped in the class can access data. These functions
provide the interface between the objects data and the program. This insulation of the data
from direct access by the program is called data hiding or information hiding.
Abstraction refers to the fact of representing the essential features without including
the background details or explanations. Classes use the concept of abstraction and are defined
as a list of abstract attribute such as size, weight and const and functions to operate on these
attributes.

e.g. When an engineer needs to add a resistor to the device she is creating, she doesn’t
typically build a new one from scratch. She walks over to a bin of resistors, examines the
colored bands that indicate the properties, and picks the one she needs. The resistor is a
“black box” as far as the engineer is concerned—she doesn’t much care how it does its work
as long as it conforms to her specifications; she doesn’t need to look inside the box to use it
in her design.

The property of being a self-contained unit is called encapsulation. With


encapsulation, we can accomplish data hiding. Data hiding is the highly valued characteristic
that an object can be used without the user knowing or caring how it works internally. Just as
you can use a refrigerator without knowing how the compressor works, you can use a well-
designed object without knowing about its internal data members.

Similarly, when the engineer uses the resistor, she need not know anything about the
internal state of the resistor. All the properties of the resistor are encapsulated in the resistor
object; they are not spread out through the circuitry. It is not necessary to understand how the
resistor works to use it effectively. Its data is hidden inside the resistor’s casing.

C++ supports the properties of encapsulation through the creation of user-defined


types, called classes. You’ll see how to create classes on Day 6, “Basic Classes.” Once
created, a well-defined class acts as a fully encapsulated entity—it is used as a whole unit.
The actual inner workings of the class should be hidden. Users of a well-defined class do not
need to know how the class works; they just need to know how to use it.

INHERITANCE
Inheritance is the process by which objects of one class acquires the properties of
objects of another class. It supports the concept of hierarchical. For e.g. the word “robin” is a
part of the class flying bird. Which is again a part of the class bird. The principle behind this
sort of division is that each derived class shares common characteristics with the class from
which it is derived.
In OOP, the concept of inheritance provides the idea of reusability. This means that
we can add additional features to an existing class without modifying it. This is possible by
deriving a new class from the existing one. The new class will have the combined features of
both the classes.

e.g. When the engineers at Acme Motors want to build a new car, they have two
choices: They can start from scratch, or they can modify an existing model. Perhaps their Star
model is nearly perfect, but they’d like to add a turbocharger and a six-speed transmission.
The chief engineer would prefer not to start from the ground up, but rather to say, “Let’s
build another Star, but let’s add these additional capabilities. We’ll call the new model a
Quasar.” A Quasar is a kind of Star, but a specialized one with new features.

C++ supports inheritance. A new type, which is an extension of an existing type, can
be declared. This new subclass is said to derive from the existing type and is sometimes
called a derived type.

POLYMORPHISM
Polymorphism is another important OOP concept. Polymorphism, a Greek term
means the ability to take more than one form. An operation may exhibit different behaviors in
different instances. The behavior depends on the types of data used in the operation. For e.g.
consider the operation of addition for two numbers, the operation will generate a sum and if
the operands are string, then the operation would produce a third string by concatenation.
The process of making an operator to exhibit different behavior in different instances
is known as Operator Overloading. An Object Oriented Program consists of a set of objects
that communicate with each other. The process of programming in an object-oriented
language, therefore involves the following basic steps :-
1. Creating classes that define objects and their behavior.
2. Creating objects from class definitions &
3. Establishing communication among objects.

e.g. The new Quasar might respond differently than a Star does when you press down on
the accelerator. The Quasar might engage fuel injection and a turbocharger, whereas the Star
would simply let gasoline into its carburetor. A user, however, does not have to know about
these differences. He can just “floor it,” and the right thing will happen, depending on which
car he’s driving.

C++ supports the idea that different objects do “the right thing” through what is called
function polymorphism and class polymorphism. Poly means many, and morph means form.
Polymorphism refers to the same name taking many forms.

ADVANTAGES OF OOPS
1. Through inheritance we can eliminate redundant code and extend the use of
existing.
2. Classes
3. We cab build programs from the standard working modules that communicate
with one another. This leads to savings of development time and higher
productivity.
4. The principle of data hiding helps the programmer to build secure programs that
cannot be invaded by code in other part of program.
5. It is possible to have multiple instances of an object to co-exist without any
interference.
6. It is easy to partition the work in a project based on object.
7. OOPs systems can be easily upgraded from small to large systems.
8. Message passing techniques is much simpler.
9. Software complexity can be easily managed.

APPLICATIONS OF OOP
The promising areas for application of OOP include :-
1. Real time systems
2. Simulations and Modeling.
3. Object oriented databases.
4. Hypertext, Hypermedia and expert text.
5. Artificial Intelligence and Expert System.
6. Neural Networks and parallel programming.
7. Decision support and office automation systems.
8. CIM / CAD / CAM systems.

You might also like