ok guys,
So Mammal human =new Mammal, what if I create another variable that points to the same object as human....So Mammal person; Now I don't want to just simply assign it like person = human, because the person will just copy the reference. Since human refers to some memory space that is storing a reference to this Mammal object, I want person variable to to refer to the same memory space that human is referring to. So basically, I want person to refer to the original reference, not simply store a copy of the reference. Because if human and person both refer to the original reference, by making one of them point to a new object , ex. person = female (female is pointing to some Mammal object), human should also point to the object that female is pointing at, which wouldnt be possible if person was just storing a copy of the reference, in which case person will point to a new object but human will point to the original object.
I hope I am clear enough....
Thanks
So Mammal human =new Mammal, what if I create another variable that points to the same object as human....So Mammal person; Now I don't want to just simply assign it like person = human, because the person will just copy the reference. Since human refers to some memory space that is storing a reference to this Mammal object, I want person variable to to refer to the same memory space that human is referring to. So basically, I want person to refer to the original reference, not simply store a copy of the reference. Because if human and person both refer to the original reference, by making one of them point to a new object , ex. person = female (female is pointing to some Mammal object), human should also point to the object that female is pointing at, which wouldnt be possible if person was just storing a copy of the reference, in which case person will point to a new object but human will point to the original object.
I hope I am clear enough....
Thanks