Null Pointer to Object problems
<p>Hi can someone tell why in Linux and windows the same problem occurs :</p>

<pre><code>#include &lt;iostream&gt;
using namespace std;

class A
{
private:
   int _dmember;

public:
   void func()
   {
     cout&lt;&lt;"Inside A!! "&lt;&lt;endl;
     cout&lt;&lt;_dmember; // crash when reach here.
   }
};

int main ()

{

    A* a= NULL;

    a-&gt;func(); // prints "Inside A!!!" 

    return 1;
}
</code></pre>

<p>can someone tell why this weird behivior occurs ? i mean , 
    the a->func() was not supposed to get inside the func() ,...? 
    this is unwated behavior , </p>

<p>why the above behivor occurs?</p>

<p>EDIT: Of course , a* =null was intentionaly!! so for all who answered "this is undefined behavior" or "you should never try to call a function on a NULL pointer !!", come on.... that was the point. and this behavior was explained correctly by some of you. </p>
