{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

We head applied programming a dangling pointer

Info iconThis 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: d just have a pointer to the actual items. would So if the head item were removed from list1, So list1 list2 would still point at it. list2 Thus, if we create two linked lists LinkedList list1, list2; then add some items to list1, and then then list1 list2 = list1; we get a copy of only the Head. we Head Applied Programming A dangling pointer. dangling This is called deep copying. This deep W hen we pass an object by value to a function or When have an object being the return value for a function, an implicit copy is also carried out. function, W e provide another class function to C++ so that We it is called whenever a copy is to be made. it This form of implicit copying is required not just This when an assignment is made. when Let's leave the assignment operation for a Let's moment and look at the other time that such copying is needed. copying Applied Programming W e might prefer to copy all the data, making We copies of the nodes of the linked list. copies Applied Programming The difference here...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online