0% found this document useful (0 votes)
68 views28 pages

Object-Oriented Programming (OOP)

The document outlines the course details for an Object-Oriented Programming course including the schedule, books, assessments, programming paradigms like procedural and OOP, differences between the paradigms, concepts like classes and objects, advantages of OOP, and examples to explain core OOP concepts such as encapsulation, inheritance and polymorphism. The course aims to teach fundamental OOP concepts and design principles through examples and exercises.

Uploaded by

Ahmed Ashraf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views28 pages

Object-Oriented Programming (OOP)

The document outlines the course details for an Object-Oriented Programming course including the schedule, books, assessments, programming paradigms like procedural and OOP, differences between the paradigms, concepts like classes and objects, advantages of OOP, and examples to explain core OOP concepts such as encapsulation, inheritance and polymorphism. The course aims to teach fundamental OOP concepts and design principles through examples and exercises.

Uploaded by

Ahmed Ashraf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 28

Object-Oriented Programming

(OOP)
Week – 01
Jan 20-24, 2019
Instructor: Basit Ali
Object-Oriented Programming (OOP)
Course Outline
Course Outline
Course Outline
Books
1. “Problem Solving with C++”, 9th edition, Walter Savitch
2. “C++ How to Program” , 7th edition, Deitel & Deitel
3. C++ the complete reference, 4th edition - herbert schildt

Compiler: VS code
Marks Distribution (Assessments / Grading)
Programming Paradigms
• 1- Sequential

• 2- Procedural

• 3- Object Oriented
Programming Paradigms
Procedural vs. Object-Oriented Programming
Procedural vs. Object-Oriented Programming

• The unit in procedural programming is function, and


unit in object-oriented programming is class
• Procedural programming concentrates on creating
functions, while object-oriented programming starts
from isolating the classes, and then look for the methods
inside them.
What is a Model?
• A model is an abstraction of something

• Real World Entities

• Purpose is to understand the product before developing it


Examples – Model

• Highway maps

• Architectural models

• Mechanical models
Example – OO Model
…Example – OO Model
• Objects
• Ali
• House
• Car
• Tree
• Interactions
• Ali lives in the house
• Ali drives the car
Object-Orientation - Advantages
• People think in terms of objects

• OO models map to reality

• Therefore, OO models are


• easy to develop
• easy to understand
Class and Object
• A class is a data type that allows programmers to create objects. A class
provides a definition for an object, describing an object’s attributes (data)
and
methods (operations).

• An object is an instance of a class. With one class, you can have as many
objects as required
Structure V/S Class
Class and Object
What is an Object?
An object is
• Something tangible (Ali, Car)
• Something that can be apprehended intellectually (Time, Date)

An object has
• State (attributes)
• Well-defined behaviour (operations)
• Unique identity
Concept: An object has behaviors

• An object contains both data and methods that


manipulate that data
• An object is active, not passive; it does things
• An object is responsible for its own data
• But: it can expose that data to other objects
Example – Ali is a Tangible Object
• State (attributes)
• Name
• Age
• Behavior (operations)
• Walks
• Eats
• Identity
• His name
Example – Car is a Tangible Object
• State (attributes)
- Color
- Model
• Behavior (operations)
- Accelerate - Start Car
- Change Gear
• Identity
- Its registration number
Data Abstraction
• Abstraction means displaying only essential information and
hiding the details.

• Data abstraction refers to providing only essential information


about the data to the outside world, hiding the background
details or implementation.
Data Abstraction (Example)
Advantages of Information Hiding
• Simplifies the model by hiding implementation details

• Prevents accidental access

• Prevents illegal access or manipulation


Concept: Classes form a hierarchy
• Classes are arranged in a treelike structure called a hierarchy
• The class at the root is named Object
• Every class, except Object, has a superclass
• A class may have several ancestors, up to Object
• When you define a class, you specify its superclass
• If you don’t specify a superclass, Object is assumed
• Every class may have one or more subclasses
Example of (part of) a hierarchy

A class hierarchy for a vehicle rental company.


Exercise!
• Scenario: A particular talent competition has 5 judges, each of whom awards a
score between 0 to 10 to each performer. A performer’s final score is
determined by dropping the lowest score received, then averaging the
remaining 4 scores.
• Task 1: Identify Attributes and functions.
• Task 2: Procedural Programming approach?
• Task 3: Object Oriented approach? (Model the problem: Identify class,
objects)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy