Question: c + + In the last assignment, you were asked to add a method to the Object class in Squeak that used a Dictionary to

c++ In the last assignment, you were asked to add a method to the Object class in Squeak that used a Dictionary to implement a method that emulated the switch statement in C++.
Suppose you, for some admittedly odd reason, wanted to do something similar in C++. Define a struct as a function object that has map as instance variable where the keys are integers and the values are objects of the class function<>(from the STL functional library). Define an overload of the function call operator in this struct that when passed an integer value will execute the matching callable object in the map. Make certain to include sufficient protocol (getter/setters) that you can use to get and set the underlying map object.
Provide a set of tests that show how you class operates (can be a main function or use can use Google Test ).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!