コード例 #1
0
        static void Main(string[] args)
        {
            IJunkFactory junkFactory = new JunkFactory();

            do
            {
                Console.WriteLine("Che spazzatura vuoi buttare? 1) plastica 2) carta 3) vetro");
                string junkType = Console.ReadLine();
                Junk   junk     = junkFactory.GetJunk(junkType);
                Console.WriteLine("Con quale camion? 1) green, 2) normale, 3) pulitore");
                string camionType = Console.ReadLine();
                Sanitation.Instance(camionType).Manage(junk);
                Console.WriteLine("Vuoi buttare altro? S si, N no");
            } while (Console.ReadLine().ToLower() == "s");
        }
コード例 #2
0
 public void Manage(Junk junk)
 {
     Console.WriteLine($"Clean {junk.Name}");
 }
コード例 #3
0
 public void Manage(Junk junk)
 {
     Console.WriteLine($"Recycle {junk.Name}");
 }