title: What will happen when I call a member function on a NULL object pointer?
body: <p>I was given the following as an interview question:</p>
  <pre><code>class A
  {
  public:
      void fun()
      {
          std::cout &lt;&lt; &quot;fun&quot; &lt;&lt; std::endl;
      }
  };
  
  A* a = NULL;
  a-&gt;fun();
  </code></pre>
  <p>What will happen when this code is executed, and why?</p>
  <hr />
  <h3>See also:</h3>
  <ul>
  <li><a href="https://stackoverflow.com/questions/2474018/when-does-invoking-a-member-function-on-a-null-instance-result-in-undefined-behav">When does invoking a member function on a null instance result in undefined behavior?</a></li>
  </ul>