Table of ContentsGeneric programming Overview The fundamental idea What is an abstraction of a data structure? Abstracting a sequence What kinds of sequences are there? Input and output differ A sample algorithm What doesn't work Strategy (classical approach) A concrete example An abstract base class How might we use it? Using InSeq Deriving from InSeq IntArraySeq member definitions Using IntArraySeq to search an array Why does it work? Advantages of this approach Disadvantages of this approach Overcoming the disadvantages Templates: overall idea Two kinds of templates A simple class template A simple function template Using these templates We could define find this way... But it's more useful to define it this way: We now declare ArraySeq as a generalization... ... and define it this way: Now we can use find almost as before: Where are we now? What is an InSeq, really? Homework (due Monday) |
Author: Andrew Koenig
Email: ark@research.att.com Home Page: http://www.research.att.com/info/ark |