/// <summary> /// Entry point into console application. /// </summary> static void Main() { //This block is written last. //create a chatroom: Chatroom chatroom = new Chatroom(); //and people in it: Participant eddie = new Actor("Eddie"); Participant wally = new Actor("Wally"); Participant beaver = new Actor("Beaver"); Participant june = new Actor("June"); Participant ward = new NonActor("Ward"); chatroom.Register(eddie); chatroom.Register(wally); chatroom.Register(beaver); chatroom.Register(june); chatroom.Register(ward); //have them chat: eddie.Send("Wally", "Lets skip school."); june.Send("Ward", "You were a little hard on the beaver last night."); beaver.Send("Wally", "Awww, man."); beaver.Send("Eddie", "You stink, and you know it."); eddie.Send("June", "You look awfully pretty today, Mrs. CLeaver."); //run the program, you'll get a list of the chat messages. //presumably it can be more intricate, like messages //will go right to a recipient, etc. }
/// <summary> /// Entry point into console application. /// </summary> static void Main() { // Create chatroom Chatroom chatroom = new Chatroom(); Participant Eddie = new Actor("Eddie"); Participant Jennifer = new Actor("Jennifer"); Participant Bruce = new Actor("Bruce"); Participant Tom = new Actor("Tom"); Participant Tony = new NonActor("Tony"); // Create participants and register them chatroom.Register(Eddie); chatroom.Register(Jennifer); chatroom.Register(Bruce); chatroom.Register(Tom); chatroom.Register(Tony); // Chatting participants Tony.Send("Tom", "Hey Tom! I got a mission for you."); Jennifer.Send("Bruce", "Teach me to act and I'll" + " teach you to dance"); Bruce.Send("Eddie", "How come you don't do standup anymore?"); Jennifer.Send("Tom", "Do you like math?"); Tom.Send("Tony", "Teach me to sing."); // Wait for user Console.ReadKey(); }