title: C++ inheritance designing a linked list
body: <p>I wanted to make a linked list class ListList that inherits from a class List.
  ListList uses functions from List, but has its own functions. It has its own start pointer that points to the beginning of the list, and its own Node struct that holds a different amount of elements.</p>
  
  <p>But, it looks like, when one of List's functions are called from ListList, List uses it's own start pointer and Node. But I want ListList's start pointer and Node to be used.
  Can someone help me figure this out?
  I could post some code, but I don't know what part would be relevant...</p>
  
  <p>this is the one I called List above</p>
  
  <pre><code>class LinkList
  {
  public:
  LinkList(); //constructor that sets the start pointer to NULL, to show that the list is empty
  ~LinkList(); //destructor that deletes each node in the linked list
  LinkList(const LinkList &amp;original); //copy constructor
  void addToken(string token); //creates a node with the given token and places it at the beginning of the linked list
  string showList(); //returns a string of tokens, separated by commas and spaces
  bool findToken(string token); //searches linked list for the given token, returns true if the token is in the list
  string getToken(string word); //searches linked list for a token that begins with the given word.
                                //Returns the full token if there's a token that begins with the given word, else returns an empty string
  void deleteList();
  protected:
  
  struct Node //each node of the linked list, held together by the next pointer
  {
      string token;
      bool second_word; //tells whether or not there is a space within the token (a two-word keyword)
                        //This could be easily changed to an int that tells how many words are within the keyword (for multi-word keywords)
      Node *next; //pointer to the next node of the linked list. NULL if there is no next node
  };
  
  Node *start; //pointer to the beginning of the linked list, and the last added node
  bool twoWordToken(string token); //returns true if there is a space located within a token, meaning the token consists of two words.
  };
  </code></pre>
  
  <p>This is the one I called ListList above</p>
  
  <pre><code>class LinkListList: public LinkList
  {
  public:
  LinkListList(); //modified contructor initiates the pointers start and ptrNode
  ~LinkListList(); //modified destructor deletes all nodes and secondaryList nodes
  LinkListList(const LinkListList &amp;original); //copy constructor
  bool addSubList(LinkList subList, string commandWord); //calls setPtrNode, then adds the given subList to that node
  bool findSubToken(string commandWord, string token); //calls setPtrNode, then calls on that node's secondaryList's findToken function
                                                       //returns true if the findToken function returns true, else returns false
  string showSubList(string commandWord); //returns a string of tokens, separated by commas and spaces, representing the subList of the given token
  string getSubToken(string word, string commandWord); //searches commandWord's subList for a token that begins with the given word.
                                                //Returns the full token if there's a token that begins with the given word, else returns an empty string
  private:
  
  struct Node //each node of the linked list, held together by the next pointer
  {
      string token;
      bool second_word; //tells whether or not there is a space within the token (a two-word keyword)
      LinkList secondaryList; //keeps a list of all related words
      Node *next;
  };
  
  Node *start; //pointer to the beginning of the linked list
  Node *ptrNode; //this pointer is used for the functions
  void setPtrNode(string token); //sets ptrNode to point to the node containing the specified token. ptrNode is NULL if the token could not be found  
  };
  </code></pre>