#ifndef LINKED_LIST_H #define LINKED_LIST_H #include using namespace std; class linked_list { public: // construct an empty list linked_list(); // copy constructor linked_list(const linked_list & rhs); // destructor ~linked_list(); // appends given value to end of list void add(int data); // returns bracketed, comma-separated version of list string to_string() const; // returns true if list contains the given value bool contains(int value) const; // returns the number of elements in the list int size() const; // removes all elements of the list, leaving it empty void clear(); // overloaded assignment operator linked_list & operator=(const linked_list & rhs); // const version of the overloaded [] operator const int & operator[](int index) const; // non-const version of the overloaded [] operator int & operator[](int index); private: struct list_node; list_node * front; list_node * back; int count; void delete_nodes(list_node * current); void copy_from(list_node * other); list_node * node_at(int index) const; }; void print(const linked_list & list); #endif