title: Input/output a vector of objects
body: <p>Tl;dr I have a bunch of code and no way to know what's wrong and how to fix it. </p>
  
  <p>This program needs to have a class "Item" store the name, price, etc. A second class has to make a list of items and have the option of printing, deleting items, etc. I haven't learned std::list yet so I'm using vectors.  The only error I get is "expected primary-expression before 'groceries'" in the second to last line.</p>
  
  <pre><code>    class Item
      {
        protected: 
          string itemName, unit;     // (i.e. can, box, pounds, or ounces)
          double numberToBuy, unitPrice, extendedPrice;
  
        public:    
          Item();
          Item (string, string, double, double);
          string getName ();
          string getUnit();
          double getNumberToBuy();
          double getUnitPrice();
          double getExtendedPrice();
          void printItem();
      };
  
      class List
      {
        private: 
          Item item;
          int numberOfItems;
          vector &lt;Item&gt; groceries;
  
        public:     
          void addItem();
          void print();
      };
  
      void List::addItem()
      {  
        int stop;
  
        while (stop != 666) 
        { 
          cout &lt;&lt; "Enter the name of your item "  &lt;&lt; endl;
          string name;
          getline(cin, name);
          cin.ignore();
          cout &lt;&lt; "Enter the units of your item "  &lt;&lt; endl;
          string unit;
          getline(cin, unit);
          cout &lt;&lt; "Enter the amount you would like to buy "&lt;&lt; endl;
          double amount;
          cin &gt;&gt; amount;
          cout &lt;&lt; "Enter the price of your item " &lt;&lt;  endl;
          double price;
          cin &gt;&gt; price;
          //Item *item = new Item(name, unit, amount, price); 
          // ^^^I don't think I need this but I'm not quite sure.
          groceries.push_back(item);
          cin &gt;&gt; stop;
        }
      }
  
      void List::print()
      {
        auto v = vector&lt;Item&gt; groceries; 
  
        copy(begin(v), end(v), ostream_iterator&lt;Item&gt;(cout, " "));
      }
  </code></pre>