title: garbage collection/destructors in C++
body: <p>I am new to C++. From what I have read, unlike java, C++ does not have automatic garbage handling, so in classes we add destructors for objects:</p>
  
  <pre><code>class A{
  
  class A();
  ~class A(); // destructor
  
  };
  </code></pre>
  
  <p>I am curious on what happens when we use structs. Also, what happens when we do not add destructors to the class? How is the memory deallocated?</p>