title: pass in fstream where ifstream expected
body: <pre><code>void foo(ifstream &amp;ifs)
  {
      //do something
  }
  
  int main()
  {
      fstream fs("a.txt", fstream::in);
      foo(fs); //error, can't compile
  }
  </code></pre>
  
  <p>The above code can't compile, seems like I can't initialize an <code>ifstream &amp;</code> with a <code>fstream</code> object? What if I do it this way:</p>
  
  <pre><code>foo(static_cast&lt;ifstream&gt;(fs)); 
  </code></pre>
  
  <p>or</p>
  
  <pre><code>foo(dynamic_cast&lt;ifstream&gt;(fs)); 
  </code></pre>