4 ms·
if you want pass a reference to a reference do Dog dog[] = { new Dog }; void method( Dog dog[] ) { dog[0] = new Dog(); } Having this of side effect as a de
by moru0011 12y ago
if you want pass a reference to a reference do
Dog dog[] = { new Dog };
void method( Dog dog[] ) {
dog[0] = new Dog();
}
Having this of side effect as a default would be an insane idea ofc., so I am not sure what you are complaining about :-)
- DonHopkins 12y agoNo, that's passing by value a reference to an object (Dog array) that contains a reference to another object (Dog). The variable "dog" that is the parameter to "method" is passed by VALUE, not by reference. Passing something by reference is NOT the same as passing a reference to something by value.