English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

3 answers

My guess is that primatives are usually small and that user-defined objects can get very big. If you had to pass a huge object by value every time, you would eat up a terrible amount of memory for no good reason. And you would probably want to pass the large object by reference anyway for simplicity's sake. I guess passing primatives by reference could save work in some cases, but it seems prone to cause confusion as well. I'm only guessing, though. Good luck!

2006-08-13 08:12:29 · answer #1 · answered by anonymous 7 · 0 0

Just to confuse you. Ha no just kidding, its to increase the compatibilty so its the ideal cross-platform language. Just be careful while declaring objects using other objects and it doesn't pose much of a problem.

2006-08-13 15:09:22 · answer #2 · answered by blainezee 2 · 0 0

if u have a variable that is a primitive and want to pass it to a function which will change it , you have to pass it by reference.If you ever want to send something to a function and be altered , u should pass by reference.It also helps performance mentioned above

2006-08-13 17:16:03 · answer #3 · answered by seyyah 1 · 0 0

fedest.com, questions and answers