InterviewSolution
| 1. |
What Are Smart Pointers? |
|
Answer» Smart POINTERS are almost similar to pointers with additional features, such as AUTOMATIC destruction of a variable when it becomes out of scope and the throwing of exceptions that ensures the proper destruction of the dynamically allocated objects. They are useful in keeping tracks of dynamically allocated objects. Due to these additional capabilities, they REDUCE the possibilities of occurrence of exceptions and errors in a program and ENSURE that the written code is safe and efficient. Smart pointers are almost similar to pointers with additional features, such as automatic destruction of a variable when it becomes out of scope and the throwing of exceptions that ensures the proper destruction of the dynamically allocated objects. They are useful in keeping tracks of dynamically allocated objects. Due to these additional capabilities, they reduce the possibilities of occurrence of exceptions and errors in a program and ensure that the written code is safe and efficient. |
|