public static bool operator ==(Macierz2x2 A, Macierz2x2 B) { if (Macierz2x2.ReferenceEquals(A, null) || Macierz2x2.ReferenceEquals(B, null)) { return(false); } else { return(A.a11 == B.a11 && A.a12 == B.a12 && A.a21 == B.a21 && A.a22 == B.a22); } }
static void Main(string[] args) { Macierz2x2 A = new Macierz2x2(1, 1, 1, 1); Macierz2x2 B = new Macierz2x2(1, 2, 2, 1); Console.WriteLine(A); Console.WriteLine(B); Console.WriteLine(A + B); Console.WriteLine(B - A); Console.WriteLine(A * B); Console.WriteLine(~A); Console.WriteLine(~B); Console.WriteLine(A == B); Console.ReadKey(); }