The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
newNode->setNext(currentNode->getNext());
sir can you please tell what happen in this lineÂ
line049 in code
Â
Â
#include<iostream>#include<stdlib.h>using namespace std;/* The Node class */classNode{public:intget() { returnobject; };voidset(intobject) { this->object=object; };Node* getNext() { returnnextNode; };voidsetNext(Node* nextNode) { this->nextNode=nextNode; };private:intobject;Node* nextNode;};/* The List class */classList{private:intsize;Node *headNode;Node *currentNode;Node *lastCurrentNode;public:List(){headNode=new Node();headNode->setNext(NULL);currentNode=NULL;lastCurrentNode=NULL;size=0;}voidadd (intaddObject){Node *newNode=newNode();newNode->set(addObject);if( currentNode!=NULL ){newNode->setNext(currentNode->getNext());currentNode->setNext( newNode );lastCurrentNode=currentNode;currentNode=newNode;}else{newNode->setNext(NULL);headNode->setNext(newNode);lastCurrentNode=headNode;currentNode=newNode;}size ++;}void display()