private void button3_Click(object sender, EventArgs e) { Elephant holder; holder = llyod; llyod = lucinda; lucinda = holder; MessageBox.Show("Objects swapped.."); }
private void button4_Click(object sender, EventArgs e) { llyod.TellMe("hi", lucinda); llyod.SpeakTo(lucinda,"its me llyod"); llyod = lucinda; llyod.EarSize = 2212; llyod.WhoAmI(); }
public void TellMe(string message, Elephant whoSaidIt) { MessageBox.Show(whoSaidIt.Name + " says: " + message); }
/// <summary> /// /// </summary> /// <param name="whoToTalkTo">With whom this elephant is talking with</param> /// <param name="message">the message to be conveyed</param> public void SpeakTo(Elephant whoToTalkTo, string message) { whoToTalkTo.TellMe(message,this); }
public Form1() { InitializeComponent(); lucinda = new Elephant() { Name = "Lucinda", EarSize = 33 }; llyod = new Elephant() { EarSize = 44, Name = "Llyod" }; }