In: Computer Science
Which of the following is true for Destructors in C++ ? Select all that apply!
Select one or more:
a. We can have return value in Destructor function to bring execution results back to main function
b. If we do not write our own destructor in class, compiler creates a default destructor for us.
c. We must write a code to call destructor function when we don't need this object anymore
d. We can have more than one destructor in a class with different parameters
e. We can release dynamically allocated memory or pointer in class in destrutor function
What are the characteristics that recursive functions must have? Select all that apply!
Select one or more:
a. Base conditions that eventually becomes true to stop the recursion
b. Have the same memory usage as corresponding iterative implementation
c. The function calls itself directly
d. Recursive functions must have return values
b. If we do not write our own destructor in class, compiler creates a default destructor for us.
e. We can release dynamically allocated memory or pointer in class in destructor function
Explanation :
*****************************
Question :
Answer :
a. Base conditions that eventually becomes true to stop the recursion
c. The function calls itself directly
d. Recursive functions must have return values
Explanation :