Week 11 Class 19 Tue Mar 23 Posted: Mar 23

Class session:

  1. Announcements:

    I am in the process of posting scores and feedback for Project 2 and will update this when they are all posted.

    I will not be strict as to the deadline for v3a.

  2. Screencast: UML Generalization notes
  3. Exercise 51: UML Generalization Crossword
  4. Exercise 52: Base.cpp

    Enter the assertions, build, and run as you follow along with the Virtual Methods: Base.cpp screencast.

    The GitHub Classroom link is in Brightspace.

  5. Screencast: Virtual Methods: Base.cpp
  6. Screencast: Design Patterns notes
  7. Exercise 53: Design Patterns Crossword
  8. Screencast: Virtual Destructors notes
  9. Exercise 54: FileIO Memory Leak

    The program ReadFile supports multiple ways to read from standard input. You run the program with the option on the command line. The options include get, read, and fileread:

    The main program is ReadFile.cpp, and the design of the program is:

    All is well and good, but the program has memory leaks with some of the options. Using valgrind determine what the problem is, fix it, and commit your fix.

    Valgrind performs dynamic analysis, which means it collects data during the execution of a program. For valgrind, running one way (e.g., using the option get) may find an issue, but running another way (e.g., using the option read) may not. To be sure, we have to run the program with all options.

    The build command is:

    To run with valgrind for option get:

    That command is a single-line but displayed using the line continuation character (“\”). You can copy and paste the entire command.

    You will have to run the command with each option, get, read, and fileread.

    The fix consists of only one change to the code. Your code must pass with a clean valgrind report for all three options.

    The GitHub Classroom link is in Brightspace. Note that on CoCalc.com, you can upload files.

Screencast Folder: Class 19 Tue Mar 23

Exercise Due Date: 4 pm on Wednesday, Mar 24