i have an assignment for oop class and i cannot figure it out. i could implement it with int[,] but it is not allowed. i have to do it with List. i can implement other methods by myself but i need help creating the constructor first. can someone help me with this problem?
Implement the types using classes. Represent the types using sequences of same-type elements (List in C#).
so far i have done this but i think this is incorrect.
public class Matrix
{
private List matrix;
private int size;
public Matrix(int b1, int b2, int n)
{
if (b1 < 0 || b2 > n - 1 || b1 + b2 != n) throw new Exception("Invalid inputs!");
size = n;
}
}
i have an assignment for oop class and i cannot figure it out. i could implement it with int[,] but it is not allowed. i have to do it with List. i can implement other methods by myself but i need help creating the constructor first. can someone help me with this problem?
Implement the types using classes. Represent the types using sequences of same-type elements (List in C#). [img]https://i.stack.imgur.com/zIXp3.png[/img]
[b]so far i have done this but i think this is incorrect.[/b] [code]public class Matrix { private List matrix; private int size; public Matrix(int b1, int b2, int n) { if (b1 < 0 || b2 > n - 1 || b1 + b2 != n) throw new Exception("Invalid inputs!"); size = n; } } [/code]