Unit 1 Session 1
Unit 1 Session 1
IN
C++
Juhi Kaneria
Lecturer in Computer Engineering Department
R. C. Technical Institute
UNIT-1
Principles of Object
Oriented Programming
Major Learning Outcomes
MAIN
PROGRAM
FUNCTION-4 FUNCTION-5
Object C
DATA
FUNCTION
Features of object oriented
programming
Emphasis is on data rather than procedure
Programs are divided into what are known as objects
Data structures are designed such that they characterize the objects
Functions that operate on the data of an object are tied together in
the data structure
Data is hidden and cannot be accessed by external function
Objects may communicate with each other through function
New data and functions can be easily added whenever necessary
Follows bottom up approach in program design
Basic Concepts of Object Oriented
Programming
Classes
Objects
Data abstraction and encapsulation
Inheritance
Polymorphism
Dynamic binding
Message passing
Objects
Collection of data members and member functions
Instance of class
May represent a person, a place, a bank account, a table of data or any item
that the program has to handle
Programming Objects be chosen to match closely with the real-world objects
Each object has unique name and occupy space in the memory
Ex: Orange, Grapes, Mango are the objects of class Fruits
OBJECT: STUDENT
DATA
Enrollment No.
Name
Date-of-birth
Marks
FUNCTIONS
Total
Average
Display
Classes
User-defined data type that behave like built-in types of programming
language
Set of data and code(function) of an object can be made a user-
defined datatype with the help of class.
Objects are instance of the type class.
Ex: Fruits Mango; (similar to int a; )
Collection of objects similar type
Data Abstraction and Encapsulation
Wrapping up of data and function into a single unit (called class) is
known as encapsulation
Data is not accessible to the outside world, and only those functions
which are wrapped in the class can access it
Insulation of the data from direct access by the program is called
data hiding or information hiding or data abstraction
Representing essential features without including the background
details or explanation
Inheritance
Process by which objects of one class acquired the properties of
objects of another classes
Hierarchical classification
Existing class is known as super class or base class
New class is known as sub class or derived class
Provides reusability
Birds
Attributes
Circle Square
Draw() Draw()
Message Passing
An object-oriented program consists of a set of objects that
communicate with each other
Process of programming in an OOP:
Creating classes that define object and their behaviour
Creating objects from class definitions
Establishing communication among objects.
Objects communicate with one another by sending and receiving
information much the same way as people pass messages to one
another.
THANK YOU!