COM SCI 32 Lecture Notes - Lecture 11: Dynamic Array, Doubly Linked List, Virtual Function
Document Summary
Cs 32 - lec 11 - templates & Uses: class x uses objects of class y. Has-a: class x contains something of class y. Is-a: class x is a specialized class y. *remember: base classes need a virtual destructor: determine how each class interacts with each other. //inside the class public: bool operator=(const dog &a, const dog &b) //2 operators: for each of operand if (a. getweight() >= b. getweight()) return true; return false; // otherwise. Item temp; temp = a; a = b; T total = t(); for (int k = 0; k < n; k++) total += a[k]; return total; template { //expensive to copy if (a For copy constructors and assignment operators foo &foo::operator=(const foo &other) foo& foo::operator=(const foo& other) foo::foo(const foo &other) foo::foo(const foo &other)