CMSC 202 Computer Science II, Fall 2015, Section 06
Lecture 12: Dynamic Memory Allocation
Thu 10/08, 2015
[Up]
[Previous Lecture]
[Next Lecture]
Assigned Reading: 10.1-10.3
Slides As Shown:
Topics Covered:
- Project 2 questions.
- Finish overloading operators.
- Using new and delete for memory allocation.
- Memory allocation and destructors:
Examples:
-
A class DMC with a dynamically allocated array:
dmc.h,
dmc.cpp.
-
A simple example with destructors being invoked when objects
go out of scope:
main1.cpp.
-
Destructors and loops:
main2.cpp.
-
Temporary objects in expressions:
main3.cpp.
-
DMC as data member in AClass:
main4.cpp.
[UMBC] |
[CSEE] |
[CMSC202] |
[CMSC202-06]
Last Modified:
22 Jul 2024 11:28:36 EDT