Chapter - 1 - Overview of Object Oriented Programming
Chapter - 1 - Overview of Object Oriented Programming
Overview of Object
oriented programming
1
STRUCTURED vs. OO PROGRAMMING
STRUCTURED PROGRAMMING:
FUNCTION 4 FUNCTION 5
2
OBJECT ORIENTED PROGRAMMING
Object 2
Object 1
Data Data
Function Function
Object 3
Data
Function
3
OBJECT ORIENTED PROGRAMMING
4
Benefits of OOP?
5
Basic concepts of OOP
class
- a category of similar objects (such as automobiles)
-does not hold any values of the object’s attributes
-object
-usually a person, place or thing (a noun)
6
Abstraction
• Focus only on the important facts about the problem
at hand
• to design, produce, and describe so that it can be
easily used without knowing the details of how it
works.
Analogy:
• When you drive a car, you don’t have to know how
the gasoline and air are mixed and ignited.
• Instead you only have to know how to use the
controls.
• Draw map
7
Encapsulation
Analogy:
ATM machine can only update accounts of one person
or object only.
8
Inheritance
9
An Inheritance Hierarchy
Superclass
Vehicle
Subclasses
10
Polymorphism
Analogy:
In English, bank can mean side of a river or a place to put
money
11
Object-Oriented Programming Languages
Pure OO Languages
Java
Hybrid OO Languages
C++
12