static void Main(string[] args) { Sparrow s1 = new Sparrow("Bob"); Sparrow s2 = new Sparrow("John"); Dialog d = new Dialog(s1, s2); }
public Dialog(Sparrow Man1, Sparrow Man2) { speaker1 = Man1; speaker2 = Man2; sayHello(speaker1); sayHello(speaker2); Random r = new Random(); for (short i = 0; i <= 5; i++) { sayReplic(speaker1, replic1Base[r.Next(replic1Base.Length - 1)]); sayReplic(speaker2, replic2Base[r.Next(replic2Base.Length - 1)]); } sayReplic(speaker1, "Kurlic-Kurlic"); sayReplic(speaker2, "Chiric-Chiric"); }
public void sayReplic(Sparrow speaker, string replic) { Console.WriteLine("{0}: {1}", speaker.name, replic); }
public void sayHello(Sparrow speaker) { Console.WriteLine("{0}: Hello!", speaker.name); }