Object-Oriented Programming (OOP) Lecture No. 1
Object-Oriented Programming (OOP) Lecture No. 1
(OOP)
Lecture No. 1
Course Objective
► Concepts
will be reinforced by their
implementation in C++
Course Contents
► Object-Orientation
► Objects and Classes
► Overloading
► Inheritance
► Polymorphism
► Generic Programming
► Exception Handling
► Introduction to Design Patterns
Books
► C++ How to Program
By Deitel & Deitel
► Assignments 15 %
► Group Discussion 5%
► Mid-Term 35 %
► Final 45 %
Object-Orientation (OO)
What is Object-Orientation?
► Highway maps
► Architectural models
► Mechanical models
Example – OO Model
…Example – OO Model
► Objects lives-in
Ali House
Ali
drives
House
Car
Car Tree
Tree
► Interactions
Ali lives in the house
Ali drives the car
Object-Orientation - Advantages
► People think in terms of objects
► State (attributes)
► Well-defined behaviour (operations)
► Unique identity
Example – Ali is a Tangible Object
► State (attributes)
Name
Age
► behaviour (operations)
Walks
Eats
► Identity
His name
Example – Car is a Tangible Object
► State (attributes)
- Color
- Model
► behaviour (operations)
- Accelerate - Start Car
- Change Gear
► Identity
- Its registration number
Example – Time is an Object
Apprehended Intellectually
► State (attributes)
- Hours - Seconds
- Minutes
► behaviour (operations)
- Set Hours - Set Seconds
- Set Minutes
► Identity
- Would have a unique ID in the model
Example – Date is an Object
Apprehended Intellectually
► State (attributes)
- Year - Day
- Month
► behaviour (operations)
- Set Year - Set Day
- Set Month
► Identity
- Would have a unique ID in the model