// CharList.h class CharListNode; class CharList { public: CharList(); bool isEmpty(); void addFirst(char c); char getFirst(); char removeFirst(); void addLast(char c); char getLast(); char removeLast(); void display(); private: CharListNode* head; CharListNode* tail; }; _______________________________________________________________________________________________________________________________________ // CharList.C #include using std::cout; using std::endl; #include "CharList.h" class CharListNode { friend class CharList; private: char data; CharListNode* next; CharListNode(char c, CharListNode* n) : data(c), next(n) { } }; CharList::CharList() { head = NULL; tail = NULL; } bool CharList::isEmpty() { return (head == NULL); } /* * CharListNode* n = head; * head = new CharListNode(c, n); * */ void CharList::addFirst(char c) { // TODO } char CharList::getFirst() { assert(head != NULL); return head->data; } /* * CharListNode* n = head; * head = n->next */ char CharList::removeFirst() { // TODO } /* * CharListNode*n = tail; * tail = new CharLIstNode(c, n); */ void CharList::addLast(char c) { // TODO } char CharList::getLast() { assert(tail != NULL); return tail->data; } /* * CharListNode* n = head; * head = n->next; * */ char CharList::removeLast() { // TODO } void CharList::display() { cout << "List: "; CharListNode* current = head; while(current != NULL) { cout << current->data; current = current->next; } cout << endl; }