Results 1 to 3 of 3

Thread: what is smart piointer?

  1. #1
    Expert Member
    Join Date
    Oct 2006
    Answers
    209

    what is smart piointer?

    what is smart piointer?

    NOTE : [This question was asked by lavanya]


  2. #2
    Junior Member
    Join Date
    Jan 2007
    Answers
    9

    Re: what is smart piointer?

    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.

    Conceptually, smart pointers are seen as owning the object pointed to, and thus responsible for deletion of the object when it is no longer needed.


  3. #3
    Expert Member
    Join Date
    Mar 2012
    Answers
    208

    Re: what is smart piointer?

    *Smart pointers is a structure in c++ and it is similar to pointers in c with some additional features like it throws an exception when it's NULL and someone tries to dereference it, or it destroys its contents automatically when it goes out of scope.
    *We use smart pointers in order to increase a pointer's IQ.
    *They keep track of the objects they point to for the purpose of memory management.
    *They prevent memory leaks by making the resource deallocation automatic: when the pointer to an object is destroyed, the pointed object is destroyed too.
    *They are implemented as a template class by means of operator overloading.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact