Question: 1. Write a C++ function template that takes two parameters and returns the greater one. Then, test your function in the main( () with integers,

 1. Write a C++ function template that takes two parameters and

1. Write a C++ function template that takes two parameters and returns the greater one. Then, test your function in the "main( () with integers, floats and characters. Hint: C++ function templates are special functions that may perform operations on generic types. This allows us to design a function that can be modified to more than one type or class without having to rewrite the complete code. 2. Write a C++ class template that will be used to hold a value of any type. First declare a class called "Var". It should have a class member to hold a value of any type. Provide a constructor and getter/setter functions. Then in the main function test your class by holding different types like integer and string etc

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 Databases Questions!