title: How to handle a "First Chance exception" in Visual studio?
body: <p>I am trying to make a pointer of the user class and assign it to the address of Teacher or Staff. I have been trying to fix this error for a long time, I couldn't;</p>
  
  <pre><code>int userType;
  User *U=NULL;
  string ID, password;
  cout &lt;&lt; "Please select user type for login -&gt; 1 : Teacher, 2 : Staff : ";
  cin &gt;&gt; userType;
  cout &lt;&lt; endl &lt;&lt; "Please key in your ID : ";
  cin &gt;&gt; ID;
  cout &lt;&lt; endl &lt;&lt; "Please key in your password : ";
  cin &gt;&gt; password;
  if (userType == 1){
      U = new Teacher();
      try{
          U-&gt;Login(ID, password);
      }
      catch (std::ifstream::failure e){
          cerr &lt;&lt; "Exception opening file" &lt;&lt; endl;
      }
  }
  else if (userType == 2){
  
      U = new Staff();
      try{
          U-&gt;Login(ID, password);
      }
      catch (std::ifstream::failure e){
          cerr &lt;&lt; "Exception opening file" &lt;&lt; endl;
      }
  }
  </code></pre>