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

In a function declaration, what does extern mean?

713


Assume studentNames and studentIDs are two parallel arrays of size N that hold student data. Write a pseudocode algorithm that sorts studentIDs array in ascending ID number order such that the two arrays remain parallel.

1828


Define a constructor - what it is and how it might be called (2 methods)?

695


What do you mean by function and operator overloading in c++?

692


Write a program which uses functions like strcmp(), strcpy()? etc

717






How do I start a c++ project?

691


what is software cycle? What is a mission critical system ? What is the important aspect of a real-time system ? Explain the difference between microkernel and macro kernel. Give an example of microkernel.Why paging is used ? Which is the best page replacement algo and Why ? What is software life cycle ? How much time is spent usually in each phases and why Which one do U want to work if selected in Honeywell ? Which are the different types of testing ? What is a distributed system ? Some questions about CSP. Which languages do U know ? What are the differences between Pascal and C. questions from Compiler construction and Lisp. Which are the different computer architecture? What is the requirement in MIMD ? What is the difference between RISC and CISC processors ? Difference between loosely coupled and tightly coupled systems ? What is an open system?

1862


Can you sort a set c++?

624


Difference between struct and class in terms of access modifier.

800


What is this pointer in c++?

870


Difference between a copy constructor and an assignment operator.

663


Implement stack operations with pointers with appropriate exception checks.

653


What is a volatile variable in c++?

655


What is a virtual destructor? Explain the use of it?

635


How const int *ourpointer differs from int const *ourpointer?

692