Interview Question: Passing-by-Value

Sample Question #67 (programming – C++)

In C++, what are some of the problems associated with passing an object by value rather than by reference?

This entry was posted in Sample Qs. Bookmark the permalink.

One Response to Interview Question: Passing-by-Value

  1. Brett says:

    Passing by value involves making a copy of the object being passed. This is inefficient for memory and speed. Memory is a serious issue, because if the object is huge (say an array of millions of elements), you could easily crash the machine.
    Passing by value also means you can’t modify the original project itself.
    Finally, passing by value won’t work when you have complicated virtual functions.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s