Question: What's a benefit of declaring the parameter as a const reference instead of declaring it as a regular object?
- The argument is passed as a reference, so the function receives a copy that can be modified without affecting the original value.
- The argument is passed as a reference, so if the passed my_array object is large, the program will require less time and memory.
- Actually objects can't be passed as regular variables because they require a constructor call. Therefore a const reference is the only way to pass class instances to functions.
- There are no benefits because a reference and an object are treated as the same thing.
Answer: The correct answer of the above question is Option B:The argument is passed as a reference, so if the passed my_array object is large, the program will require less time and memory.