Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Object – Oriented Concepts

CHAPTER – 6
OBJECT ORIENTED CONCEPTS
Introduction:
Programming approaches are of 3 types:
1. Procedural Programming
2. Structural Programming
3. Modular Programming
4. Object-Oriented Programming

1. Procedural Programming:
 This programming gives more important to step by step procedure called algorithm
 It focuses on the sequential instructions to perform a specific task.
2. Structural Programming:
 It is an organized approach for programming.
 It uses the basic control statements/ structural such as sequence, selection & Iteration
Sequence:
It is a simple construct statement in a program in an order from the beginning to the end.
Selection:
It executes certain set of statements based on some condition.
Iteration:
It is used to repeat the execution of a set of statements again and again until the condition
is satisfied.
3. Modular Programming:
 Dividing the complex problems into smaller sub programs for easy handling.
 Each sub problem is known as module.
4. Object Oriented Programming (OOP)
 Each concept is represented as an object.
 Each object will have its own data and functions.
Objects:
An object is an identifiable entity with some characteristics and behavior.
Definition:
Object Oriented Programming is a concept that combines both data and functions that
operates on that data into a single unit is called Object.

Object X Object Y

Dat Dat
a a
Functions Functions

Object Z

Dat
a
Functions

Narmada B., Dept of Computer Science Page 1


Object – Oriented Concepts

Characteristics of Object Oriented Programming:


1. Objects
2. Classes
3. Modularity
4. Data Abstraction
5. Encapsulation
6. Inheritance
7. Polymorphism
8. Dynamic Binding
9. Message Passing

1. Objects:
 Objects are the building blocks for designing progress.
 An Object represents a person, place or a table of data.
 An Object is a collection of data members and associated member functions.
Ex:
Object 1 : student Object 2 : Teacher
Member data Member data
Name Name
Reg No Subject
Course Course
Member functions Member functions
getdata ( ) getdata ( )
Display ( ) Display ( )

2. Classes:
 A Class is a collection of group of objects which share common properties and
relationships or common behaviour.
 Ex: Class Objects – Flowers
 Rose
 Lily
 Lotus etc
 Ex: Class Objects – Solar Systems
 Sun
 Moon
 Earth
 Mars
 Jupiter etc
3. Modularity:
 The process of dividing the complex problems into smaller sub problems for easy
handling is called modularity.
 Each sub programs are called modules.
4. Data Abstraction:
 The process of representing the essential features without including the
background details or explanations is called Data Abstraction.
 Ex: In mobile phone, the features such as wifi, Bluetooth and camera etc., are
essential features and how it works are the background details.

Narmada B., Dept of Computer Science Page 2


Object – Oriented Concepts

5. Data Encapsulations:
 The mechanism of combining the data and functions into a single unit is called
Data Encapsulation.
 Data Encapsulation enables data hiding or information hiding.

Object

Data

Methods

Data hiding:
 The concept of providing security to the data from direct access by the program
is called as Data hiding. It prevents unauthorized access of data.
6. Inheritance:
 The mechanism by which one class acquires the properties and behavior from an
existing class is called Inheritance.
 The existing class is a base class or super class.
 The new class is referred to as derived class or sub class.
Ex:

Super Class Father

Sub Class 1 Sub Class 2 Son Daughter

7. Polymorphism:
 Polymorphism is the ability of an operator or function to be processed in more than
one form.
Example:

Draw ( )

Draw ( ) Draw ( ) Draw ( )

Circle Square Rectangle

Polymorphism is of two types:


(a) Operator overloading:
 The process of making an operator to exhibit different behaviour in different
instances is known as operator overloading.

Narmada B., Dept of Computer Science Page 3


Object – Oriented Concepts

(b) Function overloading:


 The process using a single function name to perform different types of tasks is
known as function overloading.
8. Binding:
 Binding means linking of a procedure call to the code / function to be executed being
called.
Dynamic Binding:
 Its means the function associated with the function call is not known till the run time of
the program.
 It is also referred to as late binding.
9. Message Passing:
 In OOP’s concepts message means a request for execution of a procedure for an object.
 Message passing involves specifying the name of object, name of the function and the
information to be sent.
Ex:
college . marks (result)

Object name Function name Information


[Message]

Advantages or Benefits of OOPs:


1. Inheritance extends the use of existing classes and eliminates redundant code, hence supports
code reusability.
2. Data hiding helps to build secure programs.
3. Objects can communicate with each other without any interference.
4. Message passing technique for communication between the objects makes the interface
description simpler with external systems.
5. Concept of modularity supports teamwork i.e. each object can be developed by different
people.
6. Complexity of the software is easily manageable, tested and maintained.
Dis – advantages of OOPs:
1. It is complex to create programs based on the interaction of the objects.
2. The concept of inheritance and polymorphism requires more time initially.
3. The thought process involved in OOP takes more time to get used to it.
Applications of OOPs:
1. Simulation and modeling.
2. Computer aided design [CAD] and computer aided Manufacturing [CAM]
3. Artificial intelligence and expert system.
4. Object – oriented databases.
5. Web based applications.
6. Mobile computing.
7. Parallel programming and neural networks.

***************

Narmada B., Dept of Computer Science Page 4

You might also like