148k views
2 votes
When passing a stream to a function, it must always be pass-by-__________.

a) value
b) address
c) reference
d) class
e) function

User Erbi
by
5.6k points

1 Answer

4 votes

Answer:

C) Reference

Step-by-step explanation:

Stream objects are usually passed to functions as parameters, similar to other kind of objects. When passing a stream parameter, it must always be pass-by-reference.

This means that a reference to the original object is being passed to the function and not the copy of the object. As such, the object can be modified within the function. Also, if the object is large or has a large memory, copying it may be inefficient as regards the memory space and the time.

Therefore, object references point to the same object even when they are passed to functions.

User Vadim Hulevich
by
5.9k points