I wonder if the code below is a good (quality and correctness) implementation of a single linked list in C++, in regard of data structure (not the exposed interface).
class List
{
class Node
{
friend class List;
int value;
Node *next;
};
Node *head, *last;
public:
int size;
List()
{
head = new Node;
head->next = 0;
last = head;
size = 0;
}
~List()
{
Node *it = head, *next;
while (it)
{
next = it->next;
delete it;
it = next;
}
}
};