Why the first parameter of operator function for operator must-00932
This subjective question is related to the book/course vu cs601 Data Communication. It can also be found in vu cs601 Mid Term Solved Past Paper No. 1.
Question 1: Why the first parameter of operator function for << operator must be passed by reference?
Answer:
Operator<<'s first parameter must be an ostream passed by reference. Its second parameter, the IntList that is printed, does not have to be passed as a const-reference parameter; however it is more efficient to pass it by reference than by value (since that avoids a call to the copy constructor), and it should not be modified by operator<<, so it should be a const reference parameter