S
singhal.prateek
Hi,
How can we make two objects point to the same location? For e.g. I have
an object obj1 of a class and I want to have another object obj2 to
point to the member variables of obj1. Something like:
TestClass ob1 = new TestClass();
...
...
...
TestClass ob2 = ob1; // This doesn't work; It just creates a copy of
ob1 in ob2 and both are independent.
ob2.changeMember(); // I want this change to be reflected in ob1
Any help will be appreciated.
Thanks,
Prateek
How can we make two objects point to the same location? For e.g. I have
an object obj1 of a class and I want to have another object obj2 to
point to the member variables of obj1. Something like:
TestClass ob1 = new TestClass();
...
...
...
TestClass ob2 = ob1; // This doesn't work; It just creates a copy of
ob1 in ob2 and both are independent.
ob2.changeMember(); // I want this change to be reflected in ob1
Any help will be appreciated.
Thanks,
Prateek