Instance well keep initialise for other uses well

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ++ instance of our class. instance (We'll keep Initialise() for other uses.) (We'll Initialise() Applied Programming W e could then proceed to build our linked list We called Alist. Alist Applied Programming What happens when we leave the function? C++ helps out again. As Alist was automatic, C++ frees up space As Alist was allocated for it – the space for Head. the Head W e have the complementary function to a We constructor – a destructor. destructor But what about space we may have dynamically But allocated? allocated? This is a public function called automatically when This a variable's space is freed up so that we can clean up dynamic memory. clean W e lose contact with it - a memory leak. We We want to clean up. Note that we don't have to clean up the memory Note for the instance itself. for Applied Programming A destructor's name is the name of the class destructor's preceded by a tilde ~ as in preceded ~LinkedList(); Applied Programming LinkedList::~LinkedList() { CustPtr tm...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern