CSE2305 - Object-Oriented Software Engineering
Week 1

Topic 2: Typing and Inheritance


Synopsis


Typing¤


Strong vs Weak Typing¤¤


Static vs Dynamic Typing¤¤


Inheritance


Type Relationships


Type Inheritance

[Diagram showing a class labelled "List" above a class labelled        "OrderedList", with an arrow pointing from "OrderList" to "List"]


Inheritance Hierarchies (Trees)

[Diagram showing the class Container with subclasses List, Tree, and        Set. List has subclasses OrderedList and DoublyLinkedList. Tree has        classes BST, BTree, AVLTree.]

Reminder:


Multiple Inheritance¤

[Diagram showing classes labelled "List" and "Ordered"         above a box labelled "OrderedList", with arrows pointing         from "OrderList" to both "List" and "Ordered"]


Inheritance Graphs

[Diagram showing the classes Container, List, Tree, Set, OrderedList,         DoublyLinkedList, BST, BTree, and AVLTree (as before). Now, however,         classes OrderedList, BST, BTree, and AVLTree also inherit from         class Ordered.]

Inheritance is Transitive

[Diagram showing the classes Container, List, Tree, Set, OrderedList,         DoublyLinkedList, BST, BTree, and AVLTree (as before). Now, however,         classes OrderedList and Tree inherit from class Ordered.]

Rather than have each of the Heap, BST and BTree inherit from Ordered, separately, Tree inherits from Ordered and the properties of Ordered can then be passed on to Heap, BST and BTree.


Reading


This material is part of the CSE2305 - Object-Oriented Software Engineering course.
Copyright © Alan Dorin, Jon McCormack, Damian Conway, 1998-2006. All rights reserved.