Sample Question #67 (programming – C++)
In C++, what are some of the problems associated with passing an object by value rather than by reference?
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.
Fill in your details below or click an icon to log in:
You are commenting using your WordPress.com account. ( Log Out / Change )
You are commenting using your Twitter account. ( Log Out / Change )
You are commenting using your Facebook account. ( Log Out / Change )
You are commenting using your Google+ account. ( Log Out / Change )
Connecting to %s
Notify me of new comments via email.
Notify me of new posts via email.