Why doesn't setter change the value in C++?
<p>The following code prints:</p>

<pre><code>2
1
</code></pre>

<p>instead of</p>

<pre><code>2
2
</code></pre>

<p>Why is my setter not adjusting the value?</p>

<h2>Main</h2>

<pre><code>Vector location = camera.get_location();
camera.get_location().set_y(location.get_y() + 1);
std::cout &lt;&lt; location.get_y() + 1 &lt;&lt; std::endl;
std::cout &lt;&lt; camera.get_location().get_y() &lt;&lt; std::endl;
</code></pre>

<h2>camera.h</h2>

<pre><code>#ifndef CAMERA_H
#define CAMERA_H

#include "vector.h"

class Camera {
 private:
  Vector location;
 public:
  Vector get_location();
  void set_location(Vector);
};

#endif
</code></pre>

<h2>camera.cpp</h2>

<pre><code>#include "camera.h"

Vector Camera::get_location() { return location; }
void Camera::set_location(Vector l) { location = l; }
</code></pre>
