0% found this document useful (0 votes)
7 views18 pages

Module 05

The document discusses Object Oriented Analysis and Design, focusing on inheritance and its application in class structures. It explains how classes can share common aspects through a parent class, with examples related to products in a company. Additionally, it touches on polymorphism, highlighting its role in presenting the same interface for different data types.

Uploaded by

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

Module 05

The document discusses Object Oriented Analysis and Design, focusing on inheritance and its application in class structures. It explains how classes can share common aspects through a parent class, with examples related to products in a company. Additionally, it touches on polymorphism, highlighting its role in presenting the same interface for different data types.

Uploaded by

kalamkumar22
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Object Oriented Analysis and Design

module 05
Dr Abu-Eesa
Islamic Online University
Inheritance

 Classes may share many similarities but also significant differences


 Suppose class C1 and C2
 Class B = extract common aspects of C1 and C2
 Class B will implement all the functionality
 C1 and C2 can be much smaller containing only properties and methods
unique to them
Ancestor and descendants
Hierarchy example

 Company sells many products, for example:


 TVs
 Books
 CD’s
 DVD’s
 pens
Class product
java
python
Inheriting from product
Structure of class

 Simplistic view of application


Create object
Inheriting from an interface
Interfaces – chapter 2 in text
1. The class StudentLinkedList implements the interface StudentList.
So variables of type StudentLinkedList are also of type StudentList.
2. We declared students as of type StudentList and not StudentLinked
List.
3. We restricted ourselves to using the methods of the interface
StudentList.
Why doesn’t python have interfaces?
Inheriting from an interface

 Back to inheritance
 realisation
Polymorphism & dynamic binding

 Poly : many
 Morph: change or form
 Polymorphism: ability in programming to present the same interface for
differing underlying forms (data types)
 Shape (Circle and square)
 Polymorphism: [Link]()
 Classical way: drawSquare() and drawCircle()

You might also like