Lec 2 3
Lec 2 3
PROGRAMMING (OOP)
LECTURE NO. 2
INFORMATION HIDING
• We don’t know
• How the data is stored
• How Ali translates this information
EXAMPLE – ENCAPSULATION
• We don’t know
• How the data is stored
• How it is converted to human-readable characters
ENCAPSULATION – ADVANTAGES
• Simplicity and
clarity
• 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