Week 12 Class 19 Thu Apr 02 Posted: Apr 02
Announcements
Exercise 64: Names The UML Class Diagram shows the class Name with attributes that are single-value optionals.
Convert the class Name in the source code to use std::optional<std:string> instead of the pair of std::string and a boolean flag. The link for GitHub Classroom is in Brightspace.
Due by 3:30 pm on Fri, Apr 3.
Reminder The type String in a UML Class Diagram does not necesarily map to a std::string in a C++ program. It could map to a std::string_view, an optional std::string, or even a c-string. Which source-code type a UML type maps to is part of the code implementation, and not part of the model.
Exercise 64: Names Some of the already-submitted Names have some issues:
first() should return an empty stringAgenda
Exercise 71: Static Dispatch
The repository Base has a set of various method call situations, and a way at run time (using assert()) to verify which method is actually called. Each assertion needs to have one of the following done:
assert() in the code that indicates (via a string) which method is called, e.g., for m1() is it "Base::m1()", "Derived::m1()", or "DerivedDerived::m1()"?If the call is performed using dynamic dispatch then do not fill in the answer for the call, but instead comment out the assert(), e.g.,
Handle each assertion one at a time in order, compiling and running the program (i.e., make run) after each assertion is completed. The assertion you edited should pass, and you should be onto the next assertion.
You are required to separately commit for each block of statements in the main program.
The GitHub Classroom Invitation Link for Base is in Brightspace.
Unless otherwise noted, exercises are due by 3:30 pm on Mon, Apr 6