Principles of Digital Forensics, Unit IV Reflection Paper
September 3, 2020
Healthcare Analysis
September 3, 2020
Show all

C++ Pointers Lab

Create two triangle classes, one where the internal properties are stored on the stack and one where the internal properties are stored on the heap.  Each triangle should have a base, height, and a function that returns the area.

Triangles 1:  Create a vector of triangles where everything is stored on the stack. 

Triangles 2: Create a vector of triangles where everything is stored on the heap.

Triangles 3:  Create a vector where the items in the vector are stored on the stack, but the individual items have some data on the heap.

Triangles 4: Create a vector where the items in the vector are stored on the heap, but the individual items use no dynamic memory.

Note:  Think about what version of the triangle you should use for each scenario and make sure you do not have any memory leaks.

Leave a Reply

Your email address will not be published. Required fields are marked *