title: Equivalent of C# 'as' command in C++?
body: <p>In C# you can use <code>as</code> to convert a type or get null:</p>
  
  <pre><code>Object o = Whatever();
  String s = o as String;
  </code></pre>
  
  <p>Is there a similar easy way to achieve this in C++? </p>
  
  <p>I'm using Visual Studio 2010, if that's important.</p>
  
  <p>[Update]: Remember, there is a very important difference between casting and using <code>as</code>. Casting (at least in C#) will throw an exception if the type does not match:</p>
  
  <pre><code>Object o = null;
  String s = (String)o; // Will crash.
  </code></pre>