3 ms·
I think also they don't have a clear understanding of what each term really means.
by yock 16y ago
I think also they don't have a clear understanding of what each term really means.
- 16s 16y agoIn C++, pass-by-reference means the method gets a reference to the thing. Pass-by-value means the method gets a copy of the thing. Do these terms mean something different in Java? Again, I'm not a big Java dev, but I am interested in why there's such a big debate on this topic. In C++, I typically pass-by-reference when I need to change the thing. When I don't need to change the thing (but it's expensive to copy) I pass by const reference so the thing cannot be changed, but is still efficient. I seldom pass-by-value unless it's a primitive type (int, char, etc.).