Question: When assigning a variable's value from the returned value of an overloaded function, the type declaration may be simplified to use the auto keyword. However,

When assigning a variable's value from the returned value of an overloaded function, the type declaration may be simplified to use the auto keyword. However, the auto keyword should not be used when the return type of the overloaded function is not already known.
Three shape objects: Triangle, Rectangle, and Pentagon, have private data members for side lengths (integers), the shape's respective constructors, accessors, and print functions. In main.cpp, the overloaded resize() functions should take one of a Triangle, Rectangle, or Pentagon object, resize the sides to a factor of a non-zero positive integer, and return a new shape object with the resized sides. Ex: A Triangle with side lengths 1,2, and 3, resized by a factor of 2 should return a new Triangle with sides 2,4, and 6, respectively.
Implement the overloaded resize() function for each shape.
resize() takes in a shape object and a positive non-zero integer as the resize factor.
In each shape's implementation file, implement the shape's respective print function to output the shape's side lengths.
Ex: If a Triangle has side lengths 1,2, and 3, respectively, the output of printTri() is:

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