Hands-on 5b

Memory management

Programs auto, dynamic and static

  • Inspect the code in given files auto.cxx, dynamic.cxx and static.cxx then build and run programs one by one

  • Change the int type with myInt in the programs, build and run them again.

    • myInt type is defined in the provided myInt.h class header file. This type behaves like an integer, but prints a message when a variable of this type is created or deleted.

    • Proceed one by one.

  • Add a printing of a message at the beginning and the end of the main() in static program and observe when the static variable is deleted.