D
D
deadspace122020-04-25 11:55:30
C++ / C#
deadspace12, 2020-04-25 11:55:30

How to fix "does not implement inherited abstract member" error?

I circle each class in my code, I don’t know what to add and help pliz as a method to write to the listbox
here is my code

public partial class Form1 : Form
{
  string rabota = "инженеры";
  string direktor = "Чиженков В.Д.";
  string rabotniki = "Шульга Д.Н.  Шурко С.С.";
  int kadrs = 3;
  string admin = "Труханов В.В";
  
  public Form1()
  {
    InitializeComponent();
  }
  
  abstract class Rab
  {
    public string rabota;
    public string direktor;
    public abstract string rabi();
    public abstract string kadri();
    public abstract string admini();
    
    public Rab(string rabota, string direktor)
    {
      this.rabota = rabota; this.direktor = direktor;
    }
    
    public virtual void VirtMethod()
    {
      MessageBox.Show("Сведения о главе профессии: " + this.ToString());
    }
    
    public override string ToString()
    {
      return Convert.ToString("место работы" + rabota + "\n " + "глава " + direktor + "\n");
    }
  }
  
  class rabochie : Rab
  {
    public string rabotniki;
    
    public rabochie(string rabota, string direktor, string rabotniki)
      : base(rabota, direktor)
    {
      this.rabotniki = rabotniki;
    }
    
    public virtual void VirtMethod1()
    {
      MessageBox.Show("Данные о работниках " + this.rabi());
    }
    
    public override string rabi()
    {
      return Convert.ToString("Список работников " + rabotniki);
    }
    
    public void work1()
    {
      VirtMethod1();
    }
  }
  
  class kadr : Rab
  {
    public int kadrs;
    
    public kadr(int kadrs, string rabota, string direktor)
      : base(rabota, direktor)
    {
      this.kadrs = kadrs;
    }
    
    public virtual void VirtMethod2()
    {
      MessageBox.Show("Данные о кадрах" + this.kadri());
    }
    
    public override string kadri()
    {
      return Convert.ToString("кадр " + kadrs);
    }
    
    public void work2()
    {
      VirtMethod2();
    }
  }
  
  class Admins : Rab
  {
    public string admin;
    
    public Admins(string admin, string rabota, string direktor) : base(rabota,direktor)
    {
      this.admin = admin;
    }
    
    public virtual void VirtMethod3()
    {
      MessageBox.Show("Данные о администрации" + this.admini());
    }
    
    public override string admini()
    {
      return Convert.ToString("заместитель главы " + admin);
    }
    
    public void work3()
    {
      VirtMethod3();
    }
  }

  private void button1_Click(object sender, EventArgs e)
  {

    rabochie f = new rabochie(rabota, direktor,rabotniki);
    f.work1();
  }

  private void button2_Click(object sender, EventArgs e)
  {
     kadr f2 = new kadr(kadrs, rabota, direktor);
     f2.work2();
  }

  private void button3_Click(object sender, EventArgs e)
  {
    Admins f3 = new Admins(admin, rabota, direktor);
    f3.work3();
  }

  private void button4_Click(object sender, EventArgs e)
  {
    listBox1.Items.Clear();
  }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2020-04-25
@deadspace12

Implement all abstract methods explicitly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question