vmp
vmp

Reputation: 2420

Is there a way to call base method for overloaded operators? c#

 class x : y
{
   public static bool x operator >(x i1, x i2)
   {
          // **** 
   }
}

Is it possible to call the > from class y in ****? If so, how?

Upvotes: 2

Views: 387

Answers (1)

Sriram Sakthivel
Sriram Sakthivel

Reputation: 73482

Upcast x to y then you should be able to call y's implementation.

class x : y
{
   public static bool x operator >(x i1, x i2)
   {
        bool greater = (y)i1 > (y)i2;
        return whatever;
   }
}

Upvotes: 4

Related Questions