title: Access variable outside try-catch block
body: <p>I have the following code:</p>
  
  <pre><code>class ClassA
  {
  public:
      ClassA(std::string str);
      std::string GetSomething();
  };
  
  int main()
  {
      std::string s = "";
      try
      {
          ClassA a = ClassA(s);
      }
      catch(...)
      {
          //Do something
          exit(1);
      }
  
      std::string result = a.GetSomething();
  
      //Some large amount of code using 'a' out there.
  }
  </code></pre>
  
  <p>I would like the last line could access the <code>a</code> variable. How could I achieve that, given ClassA doesn't have default constructor <code>ClassA()</code> and I would not like to use pointers? Is the only way to add a default constructor to <code>ClassA</code>?</p>