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+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents