public static clsmath operator *(clsmath m1, clsmath m2) { clsmath m3 = new clsmath(); m3.a = m1.a * m2.a; m3.b = m1.b * m2.b; return(m3); }
static void Main(string[] args) { clsmath m1 = new clsmath(20, 40); clsmath m2 = new clsmath(5, 6); clsmath m3 = new clsmath(); m3 = m1 + m2; Console.WriteLine("A is:" + m3.a); Console.WriteLine("B is:" + m3.b); m3 = m1 * m2; Console.WriteLine("A is:" + m3.a); Console.WriteLine("B is:" + m3.b); bool ans; ans = m1 == m2; Console.WriteLine(ans); ans = m1 != m2; Console.WriteLine(ans); ans = m1 > m2; Console.WriteLine(ans); ans = m1 < m2; Console.WriteLine(ans); Console.Read(); }