title: Object instantiation within destructor of same class and garbage collection
body: <p>Recently, while taking an introductory unit focused on Object Oriented programming, I was introduced to the Garbage Collector in C#, and that it's role is to "clean up" objects that are no longer being referenced. Then I was introduced to destructors, and how they're called just before the object is deleted.</p>
  
  <p>Naturally, I got thinking, but I never remembered to ask the lecturer about it; what will happen if you create an instance of a class within the destructor of the same class?</p>
  
  <p><strong>C# example</strong></p>
  
  <pre><code>class Person{
   ~Person(){
  
    Person p = new Person();
    Console.WriteLine("Person destroyed");
  
   }
  }
  
  class Program{
   static void Main(string[] args){
    Person p = new Person();
   }
  }
  </code></pre>
  
  <p>I would like to approach this from a more theoretical point of view, so I'm reluctant (at this stage) to try it since I probably wouldn't understand anyway, but I have a few theories. Besides, I'm not at my regular computer right now ;)</p>
  
  <ul>
  <li>Person.~Person() is going to recurse, as each time the new Person is created, it's going to call its destructor and create a new Person ad infinitum, or until some kind of memory-related exception occurs. Subsequently, main will never terminate.</li>
  <li>The compiler will complain (adding this option to every scenario seems like a good idea anyway).</li>
  <li>Somehow, some kind of "destructor skipping" will occur. ie. object destruction wouldn't be called sequentially, so neither would the constructor.</li>
  </ul>
  
  <p>Now for a similarly related question. If the Garbage Collector's role is to delete the objects that are no longer referenced/needed, how would a situation like the one above be handled in an environment without a Garbage Collector - say, C++?</p>