Sunteți pe pagina 1din 18

Object-Oriented Programming (OOP) Lecture No.

Course Objective
Objective

of this course is to make students familiar with the concepts of object-oriented programming
will be reinforced by their implementation in C++

Concepts

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


The

C++ Programming Language

By Bjarne Stroustrup
Object-Oriented

Software Engineering

By Jacobson, Christerson, Jonsson, Overgaard

Grading Policy
Assignments
Group

Discussion Mid-Term Final

15 % 5% 35 % 45 %

Object-Orientation (OO)

What is Object-Orientation?
A

technique for system modeling

OO

model consists of several interacting objects

What is a Model?
A

model is an abstraction of something

Purpose

is to understand the product before developing it

Examples Model
Highway

maps models

Architectural Mechanical

models

Example OO Model

Example OO Model
Objects

Ali
drives

lives-in

House

Ali House Car Tree

Car

Tree

Interactions

Ali lives in the house Ali drives the car

Object-Orientation - Advantages
People OO

think in terms of objects

models map to reality OO models are

Therefore,

easy to develop easy to understand

What is an Object?
An object is
Something Something

tangible (Ali, Car)

that can be apprehended intellectually (Time, Date)

What is an Object?
An object has
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)
- Start Car

- Accelerate - Change Gear


Identity

- Its registration number

Example Time is an Object Apprehended Intellectually


State

(attributes)
- Seconds

- Hours - Minutes
behaviour

(operations)
- Set Seconds

- Set Hours - Set Minutes


Identity

- Would have a unique ID in the model

Example Date is an Object Apprehended Intellectually


State

(attributes)
- Day

- Year - Month
behaviour

(operations)
- Set Day

- Set Year - Set Month


Identity

- Would have a unique ID in the model

S-ar putea să vă placă și