230k views
2 votes
If a function receives an object as an argument and needs to change the objects member data, the object should be:_____________.

User Jllodra
by
7.4k points

1 Answer

3 votes

Question

If a function receives an object as an argument and needs to change the objects member data, the object should be:_____________.

A) passed by constant reference

B) passed by reference

C) passed by value

D) none of the above

Answer:

The correct answer is B)

Step-by-step explanation:

The above question relates to computer programming.

Passing by reference is the same and can be used interchangeably with passing by address.

A special ID used by a computer's procesing unit for recording or tracking data is referred to as a memory address.

When the memory address of a calling function is passed on to the function, the function is said to have been passed by address or reference.

This enables changes to be made to the function or argument directly from the parameter.

Cheers

User Harvey Kwok
by
7.2k points