Advertisement
Guest User

Untitled

a guest
Dec 13th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace Q3to5
  12. {
  13. public partial class Question5 : Form
  14. {
  15. public Question5()
  16. {
  17. InitializeComponent();
  18. }
  19.  
  20. private void Question5_Load(object sender, EventArgs e)
  21. {
  22. /* Create objects (2)"staff" and (1) professor that adds them to a LIST
  23. * Should display the information for all persons in list
  24. * invent your own values: names, age, gender, eye color
  25. *
  26. * for list <T>, use common object between both relevant classes
  27. *
  28. * thing name = new thing description
  29. */
  30.  
  31. List<Person> personList = new List<Person>();
  32.  
  33. Staff S1 = new Staff("A1", "Bob", "Schneider", "Pimp");
  34. personList.Add(S1);
  35. Staff S2 = new Staff("A2", "Punani", "Thrower", "Pimpette");
  36. personList.Add(S2);
  37.  
  38. Professor P1 = new Professor("B1", "David", "Suarez", "ProGamer");
  39. personList.Add(P1);
  40.  
  41. MessageBox.Show(personList[0].ID);
  42. MessageBox.Show(personList[1].GetInfo());
  43. MessageBox.Show(personList[2].GetInfo());
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement