title: c++ pointer scope
body: <p>What happens when you have the following code:</p>
  
  <pre><code>void makeItHappen()
  {
      char* text = "Hello, world";
  }
  </code></pre>
  
  <p>Does <code>text</code> go out of scope and get deleted automatically or does it stay in the memory?</p>
  
  <p>And what about the following example:</p>
  
  <pre><code>class SomeClass
  {
      public:
        SomeClass();
        ~SomeClass();
  };
  
  SomeClass::SomeClass() { }
  SomeClass::~SomeClass()
  {
      std::cout &lt;&lt; "Destroyed?" &lt;&lt; std::endl;
  }
  
  int main()
  {
      SomeClass* someClass = new SomeClass();
      return 0;
  } // What happend to someClass?
  </code></pre>
  
  <p>Does the same thing occur here?</p>
  
  <p>Thanks!</p>