Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace Q3to5
- {
- public partial class Question5 : Form
- {
- public Question5()
- {
- InitializeComponent();
- }
- private void Question5_Load(object sender, EventArgs e)
- {
- /* Create objects (2)"staff" and (1) professor that adds them to a LIST
- * Should display the information for all persons in list
- * invent your own values: names, age, gender, eye color
- *
- * for list <T>, use common object between both relevant classes
- *
- * thing name = new thing description
- */
- List<Person> personList = new List<Person>();
- Staff S1 = new Staff("A1", "Bob", "Schneider", "Pimp");
- personList.Add(S1);
- Staff S2 = new Staff("A2", "Punani", "Thrower", "Pimpette");
- personList.Add(S2);
- Professor P1 = new Professor("B1", "David", "Suarez", "ProGamer");
- personList.Add(P1);
- MessageBox.Show(personList[0].ID);
- MessageBox.Show(personList[1].GetInfo());
- MessageBox.Show(personList[2].GetInfo());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement