Object-Oriented Design: Generalization, Specialization, Inheritance, and Polymorphism, Slides of Object Oriented Analysis and Design

A series of lecture notes from the object-oriented design course offered at sharif university of technology. The notes cover topics such as generalization and specialization relationships, inheritance, overriding, abstract operations and classes, abstraction level, and polymorphism. The document also introduces the concept of generalization sets and provides an example of their implementation.

Typology: Slides

2011/2012

Uploaded on 02/19/2012

hester
hester 🇮🇷

4.5

(13)

84 documents

1 / 15

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Department of Computer Engineering 1 Sharif University of Technology
Object-Oriented Design
Lecturer: Raman Ramsin
Lecture 9:
Generalization/Specialization
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Object-Oriented Design: Generalization, Specialization, Inheritance, and Polymorphism and more Slides Object Oriented Analysis and Design in PDF only on Docsity!

Department of Computer Engineering

Sharif University of Technology

Object-Oriented Design

Lecturer: Raman Ramsin

Lecture 9:

Generalization/Specialization

Department of Computer Engineering

Sharif University of Technology

Analysis Workflow: Analyze a Use Case  The analysis workflow consists of the following activities:  Architectural analysis  Analyze a use caseOutputs:analysis classesuse case realizations  Analyze a class  Analyze a package

Department of Computer Engineering

Sharif University of Technology

Generalization/Specialization  Generalization hierarchies may be created by generalizing from specific things or by specializing from general things.

Department of Computer Engineering

Sharif University of Technology

Inheritance  Class inheritance is implicit in a generalization relationship between classes.  The subclass inherits the following features from its parents - attributes, operations, relationships, and constraints.

Department of Computer Engineering

Sharif University of Technology

Abstract Operations and Classes  Abstract operations are designed to have no implementation:  they serve as placeholders;  all concrete subclasses must implement all inherited abstract operations.  An abstract class has one or more abstract operations:  abstract classes can't be instantiated;  abstract classes define a contract as a set of abstract operations that concrete subclasses must implement.

Department of Computer Engineering

Sharif University of Technology

Abstraction Level  all things at the same level in a generalization hierarchy should be at the same level of abstraction.

Department of Computer Engineering

Sharif University of Technology

Polymorphism: Example

Department of Computer Engineering

Sharif University of Technology

Polymorphism: Concrete Operations  Polymorphic operations have more than one implementation:  different classes may implement the same polymorphic (abstract/concrete) operation differently;  polymorphism allows instances of different classes to respond to the same message in different ways.

Department of Computer Engineering

Sharif University of Technology

Generalization Sets: Implementation

Department of Computer Engineering

Sharif University of Technology

Generalization Sets: Example