what is smart pointer & use of the smart pointer ???

Answer Posted / satya

Smart pointers are objects which store pointers to
dynamically allocated (heap) objects. They behave much like
built-in C++ pointers except that they automatically delete
the object pointed to at the appropriate time. Smart
pointers are particularly useful in the face of exceptions
as they ensure proper destruction of dynamically allocated
objects. They can also be used to keep track of dynamically
allocated objects shared by multiple owners.

Is This Answer Correct ?    16 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Are strings immutable in c++?

884


Is c++ the hardest programming language?

833


What is encapsulation in C++? Give an example.

808


What is the difference between public, private, and protected access?

803


Why c++ is the best language?

789


What are the sizes and ranges of the basic c++ data types?

788


Can recursive program be written in C++?

880


What is the difference between reference and pointer?

834


What are disadvantages of pointers?

790


Write a C++ Program to check whether a number is prime number or not?

853


How long will it take to learn programming?

789


What is the output of the following program? Why?

812


What is an inline function in c++?

841


Is c++ primer good for beginners?

778


What is pure virtual function?

814