// implementation notes about wtdgraph functions // (as defined in wtdgraphclass.txt) // syntax/techniques for copy constructor, for example: template <class Item> wtdgraph<Item>::wtdgraph(const wtdgraph &source) : graph<Item>(source) // notice initialization list - handles parent part { // allocate space for weights only // then loop to copy just the weights from source } // about the destructor: template <class Item> wtdgraph<Item>::~wtdgraph() { // just return weights to free store IF NECESSARY // parent dtor called automatically at end } // about the assignment operator: template <class Item> wtdgraph<Item>& wtdgraph<Item>::operator= (const wtdgraph<Item> &source) { // just return *this if (this == &source) // find out (and remember) current allocation before // parent resizes; then let parent do its job: // graph<Item>::operator=(source); // allocate new space for weights if allocation changed // delete old weights if necessary // copy source weights // return *this at the end } // about other functions: // usually let parent version do some work first // e.g., graph<Item>::add_edge(source, target) // then do whatever is necessary to manage weights