I found this C++ linked list implementation in Geeks for Geeks. For the code Click here
Here from line no. 16->22 it is written
Node *head = NULL;
Node *second = NULL;
Node *last = NULL;
head = new Node();
second = new Node();
last = new Node();
I understand
- Three pointers are initialized with value
NULLand then later three instances of the class are created.
But what I don't understand is
- Where the class objects are created and
- From where the pointers are getting the addresses to point to.
- And if I keep any data in private how to access it later then in this implementation because
.operator is giving error