Lecture 18: Polymorphism
Tuesday 04/10, 2007
[Up]
[Previous Lecture]
[Next Lecture]
Assigned Reading:
Slides As Shown:
Topics Covered:
- Discussed
Project 4
- Finished heterogeneous linked list example.
Programs shown:
-
Code for HList and the HNode base class:
HList.cpp,
HList.h.
-
IntNode class derived from HNode:
IntNode.cpp,
IntNode.h.
-
Test program #1 and output:
HLtest1.cpp,
HLtest1.txt.
-
DoubleNode class derived from HNode:
DoubleNode.cpp,
DoubleNode.h.
-
StringNode class derived from HNode:
StringNode.cpp,
StringNode.h.
-
Test program #2 and output:
HLtest2.cpp,
HLtest2.txt.
-
Test program #3 and output:
HLtest3.cpp
HLtest3.txt
-
HStack is a private derivation of HList.
HStack.cpp,
HStack.h,
HStack2.h.
-
Stack tested:
HStest1.cpp,
HStest1.txt.
-
FIFO queue implemented. Check out source code for HQueue.
HQueue.cpp,
HQtest1.cpp,
HQtest1.txt,
HQueue.h.
- Macros: showed how to use macros to write a
generic Selection Sort function:
swap.cpp,
select.h,
Main program.
-
A good place for documentation on macros:
GNU Documentation on Macros.