Difference between a java object reference and C++ pointer.- The prime difference is that pointers are to locate the address of the primitive variables only, where as object reference locates the object in the heap.
- The java object reference are much closer to the C++ pointers.
An object reference in Java can do the following:
1. It can change the object which it refers to. 2. It can check if two references are equal or not. 3. It can send messages to the referenced object.
- In C++ the pointers have the same property. Hence, we can say that there is not much of a difference between the java object reference and a C++ pointer.
|