By way of a concrete example and as an illustration using something you’ve seen before, let’s take a moment to create a simple linked list. This is perhaps one of the best ways to appreciate how classes can be used.
You’ll look at four main areas:
The node—storing the command and parameter
The list—storing the nodes
Adding a node
Searching for nodes
Note that this not a complete implementation; it is just an example to cover some of the basics of using classes in C++.
In a linked-list implementation, the node commonly contains some data specific to the application under development and a pointer to the next node in the list. The next node variable points to an instance of the ...