title: C++: Checking if an object is empty in a conditional statement
body: <p>How would you check to see if an object is empty, and if it is, run a block of code?</p>
  
  <p>The function prototype looks like this:</p>
  
  <pre><code>bool Order::add(int n)
  </code></pre>
  
  <p>I need to check if n is greater than 0 and the object is not empty.(data members are 0 or null) I'm not really sure how to go around doing this to check if the object is not empty since I can't use *this in a conditional. Any help would be appreciated. </p>
  
  <p>Here is the class:</p>
  
  <pre><code>#include "ean.h"
  
  class Order {
      int copies;
      int delivered;
      bool filled = false;
      EAN eanno;
  public:
      Order();
      Order(const EAN&amp; ean);
      EAN&amp; getEAN();
      int outstanding() const;
      bool add(std::istream&amp; is);
      bool add(int n);
      bool receive(std::istream&amp; is);
      void display(std::ostream&amp; os) const;
  };
  std::ostream&amp; operator&lt;&lt;(std::ostream&amp; os, const Order&amp; order);
  </code></pre>
  
  <p>Here are the two constructors:</p>
  
  <pre><code>Order::Order() {
      copies = 0;
      delivered = 0;
      this-&gt;eanno;
  }
  
  Order::Order(const EAN&amp; ean) {
      Order();
      this-&gt;eanno = ean;
  }
  </code></pre>