// implementation notes about wtdgraph functions // (as defined in wtdgraphclass.txt) // syntax/techniques for copy constructor, for example: template wtdgraph::wtdgraph(const wtdgraph &source) : graph(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 wtdgraph::~wtdgraph() { // just return weights to free store IF NECESSARY // parent dtor called automatically at end } // about the assignment operator: template wtdgraph& wtdgraph::operator= (const wtdgraph &source) { // just return *this if (this == &source) // find out (and remember) current allocation before // parent resizes; then let parent do its job: // graph::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::add_edge(source, target) // then do whatever is necessary to manage weights