Problem

In this chapter we used only a single template class type parameter. C++ allows you to spe...

In this chapter we used only a single template class type parameter. C++ allows you to specify multiple type parameters. For example, the following code specifies that the class accepts two type parameters:

template

class Example {

}

When creating an instance of the class, we must now specify two data types, such as:

Example< 7 int, char> demo;

Create a Map class that maps keys to values. The data type for the keys and values should be specified separately using type parameters. The map forms the basis for a simple database. For example, to map from employee ID numbers to employee names, we might use integers for the data type of the keys and strings for the data type of the names. The class should have functions to:

1.Add a new key/value pair to the map

2.Set an existing key/value pair to a new value given die key

3.Delete a key/value pair from the map given the key

4.Check if a key/value pair exists in the map given the key

5.Retrieve the value for a key/value pair given die key

Use any data type you wish to implement the map. Write a main function that tests the class by exercising all of the functions with sample data.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 17
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT