Consider a situation where we have a class, XYZ, to which we have created an object What would be the name of the method invoked when the objects go out of scope?
Answers
Answered by
0
Answer:
A stack frame (or scope) is defined by a statement. That can be as big as a function or as small as a flow control block (while/if/for etc.).
Answered by
0
Calling a destructor
Destructor is called when the object of a class goes out of the scope in the program. The cases when the object goes out of scope, The program goes out of the scope of a function.
A destructor is a member function that is invoked automatically when the object goes out of scope or is explicitly destroyed by a call to delete.
Similar questions