Get premium membership and access questions with answers, video lessons as well as revision papers.

other than the incorrect freeing of dynamically allocated memory, think of a situation in which it would be improper to return an object from a...

      

other than the incorrect freeing of dynamically allocated memory, think of a situation in which it would be improper to return an object from a function.

  

Answers


Davis
There are several situations in which it would be improper to return an object.If an object opens a disk file when it is created and closes that file when it is destroyed, if that object is returned from a function, the file will be closed when the temporary object is destroyed.

Githiari answered the question on May 12, 2018 at 17:53


Next: As you know, when an object is passed to a function, a copy of that object is made.Further, when that function returns, the copy's destructor...
Previous: To illustrate exactly when an object is constructed and destructed when returned from a function, create a C++ class called who. Have who's constructor take...

View More Computer Science Questions and Answers | Return to Questions Index


Learn High School English on YouTube

Related Questions