public ref class Point
{
...
static bool operator==(Point^ p1, Point^ p2)
{
Object^ o1 = p1;
Object^ o2 = p2;
/*1*/ if (o1 == nullptr || o2 == nullptr)
{
return false;
}
if (o1 == o2) // are we testing against ourselves?
{
return true;
}
if (p1->GetType() == p2->GetType())
{
return (p1->X == p2->X) && (p1->Y == p2->Y);
}
return false;
}
};