using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
employee[] e1 = new employee[4];
e1[0] = new employee();
e1[1] = new parttimemeployee();
e1[2] = new fulltimeemployee();
foreach (employee e in e1)
{
e.add();
}
Console.ReadLine();
}
}
}
class employee
{
public string firstname="sai";
public string lastname="kumar";
public virtual void add()
{
Console.WriteLine("Base class method called");
}
}
class fulltimeemployee : employee
{
public new void add()
{
Console.WriteLine(firstname+lastname);
}
}
class parttimemeployee : employee
{
public override void add()
{
Console.WriteLine("partime employee called");
}
}
after executing above code i am getting object reference not set to an instance of an object. Please help sir im begineer

Rajan AroraRank #2,182 · 647 reputationPosted Jul 16, 2018, 8:30 PM EDT
Nanddeep NachanRank #38 · 35.2K reputationPosted Jul 16, 2018, 6:45 AM EDT
Jenith ThakkarRank #789 · 2.9K reputationPosted Jul 16, 2018, 9:29 PM EDT
employee[] e1 = new employee[3];