Hi, friends
Can anyone tell me more efficient answer of this question.
Q:-As we all know when we any object by value to a function then a temperary object is created. I observe that the destruction of this object occurs differently in different situations like .
1):- If we call a function then at the end of fuction scope.
2):- Now supose the object is passing by value to =operator then what about this?
and =oper also returning an object aby value
obj1 = obj2
Please give c++ code example
Thanx in Advance.

The easiest way to find out how objects are handled in different situations is to write a very simple program with a class that has traces in the constructor, destructor and the = operator. Another way is to use a debugger with breakpoints at the same locations.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.