Exemplo n.º 1
0
 private void button4_Click(object sender, EventArgs e)
 {
     lloyd.TellMe("Hi", lucinda);
     lloyd = lucinda;
     lloyd.EarSize = 4321;
     lloyd.whoAmI();
 }
Exemplo n.º 2
0
 private void button3_Click(object sender, EventArgs e)
 {
     Elephant temp = new Elephant();
     temp = lucinda;
     lucinda = lloyd;
     lloyd = temp;
     MessageBox.Show("Objects Swapped.");
 }
Exemplo n.º 3
0
 private void Swap_Click(object sender, EventArgs e)
 {
     //Elephant holder;
     //holder = lloyd;
     //lloyd = lucinda;
     //lucinda = holder;
     if (elephantSaver == null)
     {
         elephantSaver = lucinda;
         lucinda       = lloyd;
         lloyd         = elephantSaver;
     }
     else
     {
         lloyd   = lucinda;
         lucinda = lloyd;
         lucinda = elephantSaver;
     }
 }
Exemplo n.º 4
0
 public void SpeakTo(Elephant whoToTalkTo, string message)
 {
     whoToTalkTo.TellMe(message, this);
 }
Exemplo n.º 5
0
 public void TellMe(string message, Elephant whoSaidIt)
 {
     MessageBox.Show(whoSaidIt.Name + " says: " + message);
 }
Exemplo n.º 6
0
 public void TellMe(string message, Elephant whoSaidIt)
 {
     MessageBox.Show($@"{whoSaidIt.Name} says {message}");
 }
Exemplo n.º 7
0
 public void TellMe(string message, Elephant whoSaidIt)
 {
     MessageBox.Show(whoSaidIt.Name + " says: " + message);
 }
Exemplo n.º 8
0
 public void SpeakTo(Elephant whoToTalkTo, string message)
 {
     whoToTalkTo.TellMe(message, this);
 }
Exemplo n.º 9
0
 public Form1()
 {
     InitializeComponent();
     lucinda = new Elephant() { Name = "Lucinda", EarSize = 33 };
     lloyd = new Elephant() { Name = "Lloyd", EarSize = 40 };
 }