public static void MainOLD() { var teaMaker = new TeaMaker(); var teaShop = new TeaShop(teaMaker); teaShop.TakeOrder("Chamomile", 1); teaShop.TakeOrder("Green tea", 2); teaShop.TakeOrder("No milk, no sugar", 3); teaShop.Serve(); // Serving tea to table #1 // Serving tea to table #2 // Serving tea to table #3 }
private readonly TeaMaker mTeaMaker; // readonly, defines a read only field in our application. public TeaShop(TeaMaker teaMaker) { mTeaMaker = teaMaker ?? throw new ArgumentNullException("teaMaker", "teaMaker cannot be null"); // Returns value to it's left-hand operand if it isn't null; otherwise evaluates the right-hand operand and returns its result. // Therefore, returns teaMaker as long as it isn't null. }