Just a review of some lab 6 material on constructors and destructors. If an object is declared as a local variable, it is constructed when the declaration is encountered. If an object is declared locally, it is destroyed when it goes out of scope. If an object is allocated dynamically, it is destroyed when delete is used on its pointer.
Templates are really cool.
The idea is that when you have lots of objects that behave in the same way, you shouldn't have to write many different functions to do stuff with them. Well, maybe not. Maybe a couple of days later, you discover that your heap- sort was buggy. There Is An Easier Way. The way you compare what you're sorting With template functions, you can fix both of these problems so that you only need to write ONE heapsort function.