title: How do I check if an Object has been initialized/created in C++?
body: <p>So I have the following class...</p>
  
  <pre><code>class Pet
  {
      public:
          Pet() : id(0),
              name("New Pet")
          {
  
          }
  
          Pet(const int new_id, const std::string new_name) : id(new_id),
              name(new_name)
          {
  
          }
  
          Pet(const Pet new_pet) : id(new_pet.id),
              name(new_pet.name)
          {
  
          }
      private:
          const int id;
          const std::string name;
  };
  </code></pre>
  
  <p>Somewhere in my code I then create a instance of this class like so...</p>
  
  <pre><code>Pet my_pet = Pet(0, "Henry");
  </code></pre>
  
  <p>Later on in my code, an event is supposed to cause this pet to be deleted.
      delete(my_pet);</p>
  
  <p>How do I check if my_pet has been initialized...</p>
  
  <p>Would something like this work?</p>
  
  <pre><code>if(my_pet == NULL)
  {
      // Pet doesn't exist...
  }
  </code></pre>