Question: C++ C++ a. Fill in the underlines below to complete the definition of a function template. ______________ ______________ addition(______________) { return a + b; }
C++
C++
a. Fill in the underlines below to complete the definition of a function template.
______________
______________ addition(______________)
{
return a + b;
}
b. Write a statement that uses the function addition to calculate two double values.
Answer: ______________
c. Fill in the underlines below to complete the definition of a class template which performs addition and subtraction of two variables.
______________
______________ Calc
{
public:
______________ add(______________)
{
return a + b;
}
______________ subtract(______________)
{
return a - b;
}
};
d. Write a statement that declares calc1 to be an object of the class Calc which performs addition and subtraction of two integer variables a and b.
Answer: _____________
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
