예제 #1
0
        static void Main(string[] args)
        {
            var michaelWorker  = new SalesWorker("Michael", 2.0);
            var michaelManager = new SalesManager(michaelWorker);
            var jimWorker      = new SalesWorker("Jim", 5.0);
            var jimManager     = new SalesManager(jimWorker);
            var stanley        = new SalesWorker("Stanley", 19.0);
            var ryan           = new SalesWorker("Ryan", 4.0);
            var dwightWorker   = new SalesWorker("Dwight", 72.0);
            var dwightManager  = new SalesManager(dwightWorker);

            michaelManager.Add(jimManager);
            michaelManager.Add(stanley);
            //stanley.Add(ryan); -invalid operation
            michaelManager.Remove(stanley);
            michaelManager.Add(dwightManager);
            jimManager.Add(stanley);
            jimManager.Add(ryan);

            WriteStatistics(michaelManager);
            Console.ReadKey();
        }
 public SalesManager(SalesWorker salesWorker)
 {
     _salesWorker   = salesWorker;
     _managedPeople = new List <IEmployee>();
 }