Ошибка Additional information: Ссылка на объект не указывает на экземпляр объекта
При нажатие на кнопку указывает на ошибку.
class person
{
public string fam;
public int tab;
public string pol;
public int salary;
public person(string f, int t, string p, int s)
{
fam = f; tab = t; pol = p; salary = s;
}
public string show_info()
{
return $"Имя: {fam}\nНомер служащего: {tab}\nПол: {pol}\nОклад: {salary}";
}
}
class Manager : person
{
string company;
int sale; //объём продаж
DateTime god;
DateTime experience; //стаж
int premia;
int tax; //налог
int zp;
public new string show_info()
{
return $"Имя: {fam}\nНомер служащего: {tab}\nПол: {pol}\nОклад: {salary}\nГод приёма: {god}\nСтаж: {experience}\nПремия: {premia}\nНалог: {tax}\nЗарплата: {zp}";
}
public Manager(string c, int sal, int g, DateTime e, int pr, int ta, int z, string f, int t, string p, int s) :base(f,t,p,s)
{
company = c; sale = sal; experience = e; premia = pr;tax = ta;zp=z ;
}
public void премия()
{
premia = salary * 5 / 100;
}
public int стаж()
{
return DateTime.Today.Year - experience.Year;
}
public void налог()
{
tax = (salary + premia) * 13 / 100;
}
public void зп()
{
zp = salary + premia - tax;
}
}
person Первый;
Manager Второй;
private void button1_Click(object sender, EventArgs e)
{
string f = textBox1.Text;
int t = int.Parse(textBox2.Text);
string p = textBox3.Text;
int s = int.Parse(textBox4.Text);
string c = textBox5.Text;
int sal = int.Parse(textBox6.Text);
DateTime g = dateTimePicker1.Value;
Второй.премия();
Второй.стаж();
Второй.зп();
Второй.налог();
label1.Text = Второй.show_info();
}