D
dmly.usa
I know that in C++ you can return a constant reference to an object
like this:
int& foo()
{
int* temp = new int[3];
return const temp&;
}
so that user can only read the array but not to modify it.
Is there anyway we can do the same thing in Java?
I have tried "final" for the array but that make the array a constant
even for myself.
Thanks
like this:
int& foo()
{
int* temp = new int[3];
return const temp&;
}
so that user can only read the array but not to modify it.
Is there anyway we can do the same thing in Java?
I have tried "final" for the array but that make the array a constant
even for myself.
Thanks