OOP-Lecture 02
OOP-Lecture 02
Programming
Dr. Mujeeb Ur Rehman
[email protected]
Recommended Books:
1.C++ How to Program ( Deitel & Deitel );
2.Object-Oriented Software Engineering By Jacobson, Christerson, Jonsson,
Overgaard
Hazrat/Sir Allama Muhammad Iqbal (R.A)
Object-Oriented
Programming (OOP)
Lecture No. 2
Information Hiding
► Simplifies
the model by hiding
implementation details
► Ali
stores his personal information and
knows how to translate it to the
desired language
► We don’t know
How the data is stored
How Ali translates this information
Example – Encapsulation
►A Phone stores phone numbers in
digital format and knows how to
convert it into human-readable
characters
► We don’t know
How the data is stored
How it is converted to human-readable
characters
Encapsulation – Advantages
► Low complexity
► Better understanding
Object has an Interface
► This includes
Data structures to hold object state
Functionality that provides required
services
Example – Implementation of
Gear Box
► Data Structure
Mechanical structure of gear box
► Functionality
Mechanism to change gear
Example – Implementation of
Address Book in a Phone
► Data Structure
SIM card
► Functionality
Read/write circuitry
Separation of Interface &
Implementation
► Low Complexity