When we create an object in java : ( Say that we have a class called A )
And when we create an object in c++ :
In java it's called reference to access the object but in C++ it's called pointers
i know pointers as well but my question does reference is the same for pointers ? since both of them are allocated on the stack and holds the address of the object so i just want to know if reference of java differ from the pointers of c++.
Thank you.
Code:
A obj = new A();
Code:
A *ptr = new A();
i know pointers as well but my question does reference is the same for pointers ? since both of them are allocated on the stack and holds the address of the object so i just want to know if reference of java differ from the pointers of c++.
Thank you.