Lab 12 Prelab Questions 1. You have used templates already in 202! Find code from any project 1-4 and paste a few lines below. 2. Describe the process the compiler goes through to generate a compilable class from a templated class definition. 3. Describe some design decisions that should be considered when designing a templated class. 4. Think of a function that would benefit by using templates. Write it. 5. Suppose I have a class called "Holder" which is a templated class, and lets say I am compiling it with my other file main.cpp like this: g++ -ansi -Wall main.cpp Holder.cpp , but it is not compiling, just from the information given above, why would it not compile? 6. Describe the differences in the C++ mechanics of getting templated classes to work versus normal classes (i.e. what are the differences in the "setup" of the class files, makefiles, etc.). 7. Suppose my main.cpp is: #include "Holder.h" #include #using namespace std; int main() { Holder strHolder("I love c++"); Holder intHolder(7); cout << strHolder << endl; cout << intHolder << endl; return 0; } Write the Holder.h and Holder.cpp so that the program outputs: Holder has "I love c++" Holder has "7" 8. Describe the benefits of using templates. Describe the drawbacks of using templates. 9. Provide an example where templates are the best solution. Provide an example where templates are NOT the best solution. 10. Based on your analysis in #9 and your examples in #10, what are some of the characterstics of a problem that templates should be used for? What are some of the characteristics of a problem that templates should NOT be used for?