title: Why can I call a function on a Class that has not been instantiated?
body: <p>Can someone please explain why the below code is able to call the SayHello function and print out "Hello".</p>
  
  <p>The constructor and destructor never get called as there is no object actually created, so why then can I call the SayHello function??</p>
  
  <pre><code>class A
  {
  public:
      A()
      {
          std::cout&lt;&lt;"In Constructor"&lt;&lt;std::endl;
      };
      ~A()
      {
          std::cout&lt;&lt;"In Destructor"&lt;&lt;std::endl;
      };
  
      void SayHello()
      {
          std::cout&lt;&lt;"Hello"&lt;&lt;std::endl;
      }
  };
  
  int _tmain(int argc, _TCHAR* argv[])
  {       
      A* a = nullptr;
      a-&gt;SayHello();
  
      return 0;
  }
  </code></pre>