Week 8 Class 14 Thu Mar 04 Posted: Mar 04

Class session:

  1. Announcements:

    The screencast for the Midterm Overview is now part of the class on Tuesday, Mar 9. I will post it early at Noon on Friday.

  2. Screencast: Callbacks: Lambda Functions notes
  3. Exercise 36: Callbacks: Lambda Functions Crossword
  4. Screencast: convert.cpp lambda functions

    Note the code-along exercise that goes with this screencast.

  5. Exercise 37: convert.cpp II

    There are two parts to this exercise. In the first, apply lambda functions to the main branch of convert.cpp (the one with the std::unordered_map). I show these changes in the screencast.

    The second part is to apply lambda functions to a branch of convert.cpp. These changes are to the version of convert.cpp before we switched to a map. I start to prepare for this in the screencast, but I do not show these changes. So in this exercise, make these changes.

    The screencast covers how to set this up:

    1. Figure out the commit id for the commit with the message “Extract typedef for conversion function pointer”. Note that it is the one before the commit with the message “Extract map for conversion from option to conversion function”. What you need is the 7-character commit id at the start of the output of the following command:
       $ git log --oneline
      

      For purposes of the rest of the explanation, that value is “3f78fd6”.

    2. Change to that commit
       $ git checkout 3f78fd6
      

      Note that your commit id is almost sure not to be the same.

    3. Create a new branch at this point
       $ git switch -c olddesign
      
    4. Make your changes on the branch olddesign, committing as you go
    5. When you push, you will see an error as the branch exists in your local repository but not at GitHub. Follow the instructions that it gives.
       $ git push
       fatal: The current branch olddesign has no upstream branch.
       To push the current branch and set the remote as upstream, use
      
       git push --set-upstream origin olddesign
       $
      

      Follow the instructions that it gives:

       $ git push --set-upstream origin olddesign
      

    Other useful git branch commands:

    Get back to the main branch git checkout main
    Get back to the olddesign branch git checkout olddesign
    View your current branch git branch
    View all local branches git branch --list
    View all local and remote branches git branch --all
  6. Screencast: Member Initialization Lists

    Note the code-along exercise that goes with this screencast.

  7. Exercise 38: Member Initialization List

    Make the changes in the screencast to the files for your GitHub Classroom repository for Member Initialization List

  8. Screencast: Encapsulation & Information Hiding Part 1

    We will cover Part II of the screencast next week. There is no exercise today for this screencast.

Screencast Folder: Class 14 Thu Mar 04

Exercise Due Date: 4 pm on Friday, Mar 05

Reminders: