List.h 789 B

1234567891011121314151617181920212223242526272829303132333435
  1. #include "ListNode.h"
  2. #include <string>
  3. #ifndef LIST_H
  4. #define LIST_H
  5. using namespace std;
  6. class List
  7. {
  8. public:
  9. // constructor with 0 parameters
  10. List();
  11. // constructor with name parameter
  12. List(string name);
  13. // Destructor
  14. ~List();
  15. // insert at front of list
  16. void insert_at_front(void * data);
  17. // insert at back of list
  18. void insert_at_back(void * data);
  19. // remove from front of list
  20. void * remove_from_front(void);
  21. // remove from back of list
  22. void * remove_from_back(void);
  23. // get the first node in the list
  24. ListNode * get_first(void);
  25. protected:
  26. ListNode * first_node;
  27. ListNode * last_node;
  28. string name;
  29. };
  30. #endif