title: How to delete an object (class) through destructor method
body: <p>I'm wonder to know is it possible to delete an object through destructor method?</p>
  
  <p>Constructor and destructor of my class:</p>
  
  <pre><code>class cal
  {
      public:
          cal()
          {
              days = 0;
              day = 1;
              month = 1;
              year = 1300;
              leap = true;
          };
          ~cal()
          {
              delete this;
          }
  }*calendar = new cal;
  </code></pre>
  
  <p>How can I delete this pointer through class?</p>
  
  <p><strong>P.S</strong></p>
  
  <p>I forgot to write the following code</p>
  
  <pre><code>cal *calandar = new cal[];
  </code></pre>
  
  <p>I want to use it in heap not stack</p>
  
  <p>I want to use this class (objects) frequently (many of that object) imagine how many time should I write delete and it make hard understanding, troubleshooting and tracing codes I want them to been destroyed automatically (in heap)</p>
  
  <p>I used following code in my class when I exec "delete[] calendar" it reduce my rams occupied (amount of ram that is used) does it work properly (destroy all objects) by exiting program? Because I use GNU/Linus and it destructs all objects with or without that lines I'm concern about leaking in windows</p>
  
  <pre><code>void DisposeObject() { delete this; }
  </code></pre>