Beispiel #1
0
        public static void Run()
        {
            var cafe = new Cafe
            {
                Name  = "The best cafe ever",
                Rooms = new List <Room>
                {
                    new Room {
                        Name = "Orange", Seats = 3
                    },
                    new Room {
                        Name = "Green", Seats = 1
                    },
                    new Room {
                        Name = "Blue", Seats = 2
                    }
                }
            };

            var visitors = new List <Guest>
            {
                new Guest {
                    Name = "Isabell"
                },
                new Guest {
                    Name = "Mark"
                },
                new Guest {
                    Name = "Iris"
                },
                new Guest {
                    Name = "Ann"
                },
                new Guest {
                    Name = "John"
                },
                new Guest {
                    Name = "Dany"
                },
                new Guest {
                    Name = "Sean"
                }
            };

            var inspector = new Inspector {
                Name = "Freimuth"
            };

            // Cafe accepts visitors
            visitors.ForEach(cafe.Accept);

            // Cafe accepts inspector
            cafe.Accept(inspector);
        }
Beispiel #2
0
 /// <summary>
 /// Implements concrete logic for visiting Cafe
 /// </summary>
 /// <param name="cafe"></param>
 public void Visit(Cafe cafe)
 {
     Console.WriteLine("Hi, do you have a free seat?");
 }
Beispiel #3
0
 /// <summary>
 /// Implements concrete logic for visiting Cafe
 /// </summary>
 /// <param name="cafe"></param>
 public void Visit(Cafe cafe)
 {
     Console.WriteLine($"Hi, i'll check your rooms");
 }