 C# Overloading operator == 
<pre><code>//overloading operator ==
class Point
{
    private int m_X,int m_Y;

    public static operator == (Point p1 ,Point p2)
    {
        if(object.ReferenceEquals(p1,p2)
            return true;

        if((object)(p1) == null) || ((object)(p2) ==null)
            return false;

        return( (p1.x == p2.x) &amp;&amp; (p1.x == p2.x));
    }

    //overloading the != operator
}
</code></pre>

<ol>
<li>Is it necessary to override the Equals function</li>
<li>if the p1 and p2 is not typecasted to object , stack overflow exception is thrown
Why we need to the Point objects to typecast to object. </li>
</ol>
