[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question About When Objects Are Destroyed

On 8/4/2017 4:34 PM, gst wrote:
> 'two' is a so called constant or literal value .. (of that
> function).
> Why not attach it, as a const value/object, to the function itself ?
> So that a new string object has not to be created each time the
> function is called. Because anyway strings are immutable. So what
> would be the point to recreate such object every time the function is
> called ?

This was just an example program, not meant to do anything
meaningful. I would think that the same object behavior would
occur if I dynamically created an object in that function.