CS174: Static (Stack) vs Dynamic (Heap) Object Review

Developed by Professor Tralie and Professor Mongan.


Watch the video below that I dug up from fall 2020 to help you warm back up after spring break on static vs dynamic objects

Notes

  • Object reference pitfall 1: you should only delete objects that you've allocated dynamically with a new
  • Object reference pitfall 2: Since object values declared in a method are deleted when the method completes, you will get a segfault if you return and try to use references to them.