Question: Listed below are some desired effects. Indicate, by circling the appropriate character(s), whether each can be accomplished with overloaded functions ( O ) and/or a

Listed below are some desired effects. Indicate, by circling the appropriate character(s), whether each can be accomplished with overloaded functions (O) and/or a function with default arguments (D) and/or a function template (T) or none of them (N).

[ O D T N ] CalcMass(density, volume) returns the mass of an object having a density of density and a volume of volume, whereas CalcMass(density) returns the mass of an object having a density of density and a unit volume (1.0 cubic feet, say). All quantities are of type double.

[ O D T N ] Repeat(10, "Rats!") displays the string argument 10 times, whereas Repeat("Dang it!") displays the string argument 3 times.

[ O D T N ] CalcAvg(3, 6) returns the int average of two int arguments, whereas CalcAvg(3.0, 6.0) returns the double average of two double arguments.

[ O D T N ] SmartAssign("Excellent") returns the character 'E' or a pointer to the string "Excellent" depending on whether the return value is assigned to a char variable or to a pointer to char variable.

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!