public Matrix(int a, int b, int c, int d)
public static Matrix operator*(int n, Matrix A)
public static Matrix operator+(Matrix A, Matrix B)
public static Matrix operator-(Matrix A, Matrix B)
public Matrix add(Matrix other)
return new Matrix(m_a + other.m_a, m_b + other.m_b, m_c + other.m_c, m_d + other.m_d);
public Matrix scalarMult(int n)
return new Matrix(n*m_a, n*m_b, n*m_c, n*m_d);
public Matrix subtract(Matrix other)
return new Matrix(m_a - other.m_a, m_b - other.m_b, m_c - other.m_c, m_d - other.m_d);
public override String ToString()
return "|" + m_a + "\t" + m_b + "|\n|" + m_c + "\t" + m_d + "|";
public static void Main()
Matrix A = new Matrix(1, 2, 3, 4);
Matrix B = new Matrix(4, 2, 6, 3);
Console.WriteLine(A.scalarMult(2));