T
Tom
If I have a container class that has a map member which stores pointers
to objects that have been created via the new operator and I have a
method that returns a entry in the map, would it be best to return the
entry as a dereferenced pointer so it becomes a class or return a
reference to the dereferenced class?
I believe that it would be best to dereference the class pointer
retrieved from the map and then send it back as a reference to the
caller. This would ensure that any manipulations to the returned class
would be reflected in the class stored in the container objects map?
It may be that the container class will be shunted around the
application and the data contained in it manipulated in various methods
and functions.
TIA,
Tom.
to objects that have been created via the new operator and I have a
method that returns a entry in the map, would it be best to return the
entry as a dereferenced pointer so it becomes a class or return a
reference to the dereferenced class?
I believe that it would be best to dereference the class pointer
retrieved from the map and then send it back as a reference to the
caller. This would ensure that any manipulations to the returned class
would be reflected in the class stored in the container objects map?
It may be that the container class will be shunted around the
application and the data contained in it manipulated in various methods
and functions.
TIA,
Tom.