K
Ken
If a class contains a private array, and a public method of that class
returns that array using a return statement (e.g., return myArray),
will the caller get a deep copy of the array or a reference to the
encapsulated array? If it is the latter, is there a way to return the
array as a constant so that the caller cannot change the values on the
array?
Thanks!
Ken
returns that array using a return statement (e.g., return myArray),
will the caller get a deep copy of the array or a reference to the
encapsulated array? If it is the latter, is there a way to return the
array as a constant so that the caller cannot change the values on the
array?
Thanks!
Ken