COM SCI 32 Lecture Notes - Lecture 11: Dynamic Array, Doubly Linked List, Virtual Function

130 views10 pages

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)

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents