private void button4_Click(object sender, EventArgs e) { lloyd.TellMe("Hi", lucinda); lloyd = lucinda; lloyd.EarSize = 4321; lloyd.whoAmI(); }
private void button3_Click(object sender, EventArgs e) { Elephant temp = new Elephant(); temp = lucinda; lucinda = lloyd; lloyd = temp; MessageBox.Show("Objects Swapped."); }
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; } }
public void SpeakTo(Elephant whoToTalkTo, string message) { whoToTalkTo.TellMe(message, this); }
public void TellMe(string message, Elephant whoSaidIt) { MessageBox.Show(whoSaidIt.Name + " says: " + message); }
public void TellMe(string message, Elephant whoSaidIt) { MessageBox.Show($@"{whoSaidIt.Name} says {message}"); }
public Form1() { InitializeComponent(); lucinda = new Elephant() { Name = "Lucinda", EarSize = 33 }; lloyd = new Elephant() { Name = "Lloyd", EarSize = 40 }; }