Programming - Constructor - Discussion

You Are Here :: Home > C++ Language > Constructor - Discussion

 



Q.

Assume you have to write a class that makes use of dynamic memory allocation (the class needs to allocate and de-allocate memory). According to best practices, where would the keyword ‘new’ be placed?                         


A. Classes are smart data types. The compiler takes care of calling new/delete. B. In the constructor
C. In the destructor D. In a separate, dedicated function

Answer: Option B
Explaination:

 


No Explanation




Discussion

Your Comments Goes here...
NameDiscussion