0

Should we pass variables of objects in function of class to access them in function and also manipulate them?

If we are changing their value would the affect the object variables in main()

4th Feb 2020, 7:12 PM
Ankit Sharma
Ankit Sharma - avatar
3 Antworten
+ 1
It depends.... Some people say, it is a better style to do so. Actually if u pass an object to a function, it is a call by reference so the object in main is effected.
4th Feb 2020, 8:58 PM
Oma Falk
Oma Falk - avatar
+ 1
For which of the languages are you asking? The different languages treat it differently.
4th Feb 2020, 10:32 PM
HonFu
HonFu - avatar
0
HonFu c++
5th Feb 2020, 5:53 AM
Ankit Sharma
Ankit Sharma - avatar