Advertisement
MarkDev

Untitled

Jun 29th, 2021
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.45 KB | None | 0 0
  1. Основной код:
  2.  
  3. private void button1_Click(object sender, EventArgs e)
  4.         {
  5.             aspirsnt asp = new aspirsnt("Олег", "Иванович", "Самойлов", 3, 4.23); // тут нужно указывать значения которые будут отображаться
  6.             MessageBox.Show("Информация о студенте:\n\n" + "Имя: " + asp.name + "\nФамилия " + asp.surname + "\nОтчество: " + asp.othname + "\nУчебный курс: " + asp.course + "\nСредний балл(успеваемость): " + asp.uspevaemost);
  7.         }
  8.  
  9.  
  10. Код основного класса:
  11.  
  12. class student
  13.     {
  14.         public string name; // имя студента
  15.         public string surname; // фамилия студента
  16.         public string othname; // отчество студента
  17.         public int course; // курс студента (1, 2, 3, 4, 5)
  18.  
  19.         public student(string a, string b, string c, int d)
  20.         {
  21.             name = a;
  22.             surname = b;
  23.             othname = c;
  24.             course = d;
  25.         }
  26.     }
  27.  
  28.  
  29. Код класса-наследника:
  30.  
  31. class aspirsnt : student
  32.     {
  33.         public double uspevaemost; // средний балл студента (успеваемость)
  34.  
  35.         public aspirsnt(string a, string b, string c, int d, double t) : base(a, b, c, d)
  36.         {
  37.             uspevaemost = t;
  38.         }
  39.     }
  40.  
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement