0

I create the Fraction Input and Output it was fine, and then I try to put the array of the Fraction. Everything work fine until I Compile and execute the Program.

This Error appear: Nullreferenceexception object reference not set to an instance of an object.

Help me this error! Thanks so much!!!

```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Array
{
using Fraction;
public class CArray
{
private int number;
private CFraction[]ps;
public CArray()
{
this.ps = null;
this.number = 0;
}
public CArray(CArray m)
{
this.number = m.number;
CFraction[]ps = new CFraction[number];
for (int i = 0; i < number; i++)
{
this.ps[i] = m.ps[i];
}
}
public void Input()
{
Console.Write("Please Input the number: ");
number = Convert.ToInt32(Console.ReadLine());
ps = new CFraction[number];
for (int i = 0; i < number; i++)
{
Console.Write("ps[{0}]: ", i+1);
ps[i].Input();
}
}
public void Output()
{
Console.Write("Result: ");
for (int i = 0; i < ps.Length; i++)
{
ps[i].Output();
}
}
}
}
```

```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Fraction
{
public class CFraction
{
private int numerator;
private int denominator;
public CFraction()
{
this.numerator = 0;
this.denominator = 1;
}
public CPhanSo(int numerator, int denominator)
{
this.numerator = numerator;
this.denominator = denominator;
}
public override bool Equals(object obj)
{
if (obj == null || GetType() != obj.GetType()) return false;
CPhanSo ps = (CPhanSo)obj;
return numerator.Equals(ps.numerator) && denominator.Equals(ps.denominator);
}
public override int GetHashCode()
{
return numerator.GetHashCode()^denominator.GetHashCode();
}
public void Input()
{
Console.Write("Input numerator: ");
this.numerator = Convert.ToInt32(Console.ReadLine());
Console.Write("Input denominator: ");
this.denominator = Convert.ToInt32(Console.ReadLine());
}
public void Output()
{
Console.WriteLine("Fraction : {0}/{1}", this.numerator, this.denominator);
}
}
}
```

```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ProGram
{
using Fraction;
using Array;
class Program
{
static void Main(string[] args)
{
CArray m = new CArray();
m.Nhap();
m.Xuat();
}
}
}
```