title: collection of pointers pointing to objects, clarification
body: <p>I am quite new to c++ so I have a lot of problems with pointers, although I understand the concept. The problem is that I am making a vector of pointers in my main:</p>
  
  <p><strong>main/Aquarium.cpp</strong>:</p>
  
  <pre><code>using namespace std;
  #include "EntityControl.h"
  #include &lt;Windows.h&gt;
  
  int main() {
  
      EntityControl entity;
      vector&lt;Fish*&gt; fishVector;
      Fish q;
      cout &lt;&lt; "fish q = " &lt;&lt; &amp;q &lt;&lt; endl;
      fishVector.push_back(&amp;q);
  
          entity.movementController(&amp;fishVector);
          cout &lt;&lt; &amp;fishVector &lt;&lt; endl;
          system("pause");
       return 0;
  }
  </code></pre>
  
  <p>As you can see I add the location where you can find the fish to the fishVector, I then want to do something with the object in my EntityControl class. But I don't know how to do this, I tried getting it with a for loop but when trying to cout the result, the location is different than the fish in main.cpp.</p>
  
  <p><strong>EntityControl.cpp</strong></p>
  
  <pre><code>#include "EntityControl.h"
  
  
  void EntityControl::movementController(std::vector&lt;Fish*&gt; * fishInputVector)
  {
          unsigned int x = rand() % xContainer;
          unsigned int y = rand() % yContainer;
          unsigned int z = rand() % zContainer;
          //i.changePosition(x, y, z);
  }
  
  EntityControl::~EntityControl()
  {
  }
  </code></pre>
  
  <p>There were a few posts of this on stackoverflow, but I didn't understand the answers. I thought I needed some extra help. So if you can explain it as easily as you can then I would be very grateful.</p>
  
  <p><strong>problem clarification</strong>: adding the memory location of a Fish object to a vector (or any collection that suffices) in main then receiving the memory location and working with the object that the memory location points to in EntityControl.cpp</p>
  
  <p><strong>extra questions</strong>:
  I thought I needed a pointer to change the actual variable value in a class but,</p>
  
  <pre><code>void Fish::changePosition(int addX, int addY, int addZ)
  {
      xLocation = addX;
      yLocation = addY;
      zLocation = addZ;
  
      //std::cout &lt;&lt;"VALUE ="&lt;&lt; getX();
  }
  </code></pre>
  
  <p>seems to work fine, could you explain this? (x,y,z locations are private global variables in the Fish class)</p>
  
  <ul>
  <li><p>If I make a pointer, should I delete the object/variable that it's
  pointing to? does it stay in the memory ?</p></li>
  <li><p>Are there any good resources I can read that might help me?</p></li>
  </ul>
  
  <p><strong>last note</strong>
  If anyone can help me, thank you very much. This problem has been driving me crazy for hours.</p>