class Customer
{
public string name;
public sting nic;
public int age;
public void add_customer()
{
// some code here to assign the values to the data types
}
}
class main_menu
{
Customer[] cust = new Customer[100];
// some other data members
public void new_customer()
{
// Some Console.WriteLine pritings
cust[0].add_customer();
// ------>> Now here in this line error is arrising which says
An unhandled exception of type 'System.NullReferenceException' occurred in Assignment 2.exe
Additional information: Object reference not set to an instance of an object.
}
}
现在我要做的是在所有客户实例中一一填充对象数组中的数据变量
请帮助我,因为我是初学者