Question: 1) write a constructor function (not inline) for Square objects. It should take a vector of string tokens as its only parameter. If there are
1) write a constructor function (not inline) for Square objects. It should take a vector of string tokens as its only parameter. If there are at least 2 tokens, the one at index 1 is the side dimension.
Do not write the prototype -- just the function as it would appear elsewhere in the CPP. When you write code for an exercise like this, write in "preformatted" instead of the default "paragraph".
2) write a constructor function (not inline) for Square objects. It should take a vector of string tokens as its only parameter. If there are at least 2 tokens, the one at index 1 is the side dimension.
But apply the principle of least privilege. The parameter should be constant, and the side dimension should be a constant data member.
Do not use const_cast . Use an initializer list. Do not write the prototype -- just the function as it would appear elsewhere in the CPP.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
