How do I store objects within another object in C++?
<p>I want to make sure that I'm creating/destroying this object properly...</p>

<p>This is the definition of my Camera object which contains references to Vector objects:</p>

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

#include "vector.h"

class Camera {
 private:
  Vector* location;
  Vector* direction;
  float velocity;
 public:
  Camera();
  ~Camera();
};

#endif
</code></pre>

<p>which are created in the constructor:</p>

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

Camera::Camera() {
  location = new Vector(1.0, 1.0, 1.0);
  direction = new Vector(1.0, 1.0, 1.0);
  velocity = 0.0;
}

Camera::~Camera() {
  delete location;
  delete direction;
}
</code></pre>

<p>then, whenever I want a camera object I simply call <code>Camera camera</code>. </p>

<ul>
<li><p>Am I correct in assuming that when the variable <code>camera</code> goes out of
scope, the destructor will be called and I won't suffer any memory
leak?</p></li>
<li><p>If I want to remove the variable <code>camera</code> before the scope closes, is
it correct to perform <code>delete camera</code>?</p></li>
</ul>
