CS 106B Lecture Notes - Lecture 17: Linked List, Memory Management

44 views2 pages

Document Summary

Logistics: thursday sections: not mandatory after noon. Feel free to find another to attend: midterm tomorrow evening, boggle: due on monday. Dynamic memory allocation: delete: after creating an array, when we delete it we do not delete the array. We just give back the memory and promise not to use it: you have a responsibility when using dynamic memory allocation to delete anything you have requested via new. We can fix this by adding a (cid:498)destructor(cid:499) (cid:523)~ before class(cid:524) When thee class instance goes out of scope, the destructor is called, cleaning up the memory for us (no need to call it manually) Vectorint class: implementation: has these properties. Can hold ints (holding other types is beyond scope of this class) Has useful functions: add(), insert(), get(), remove(), isempty(), size(), << overload. Can add as many elements as we like. Cleans up its own memory: code writing included in recording.

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