title: Store object as pointer in class in C++
body: <p>I'm learning C++ right now and I wanted to get a little advice on storing member variable objects. I want to store an instance of B in A, what is the best way to do this?</p>
  
  <p><strong>[EDIT]</strong> - I made the example more real world. I need to be able to construct and assign a texture at runtime and assign it to a game object.</p>
  
  <pre><code>class GameObject
  {
  public:
      Texture texture;
  };
  
  ....
  
  GameObject gameObject;
  Texture texture;
  
  gameObject.texture = texture;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>class GameObject
  {
  public:
      Texture *texture;
  };
  
  ....
  
  GameObject gameObject;
  
  gameObject.texture = new Texture;
  </code></pre>
  
  <p>I'm trying not to use pointers, but in some instances I feel I need to.</p>