Beispiel #1
0
        static void Main(string[] args)
        {
            Manager accountingVP = new Manager();

            accountingVP.FirstName = "Emma";
            accountingVP.LastName  = "Stone";
            accountingVP.CalculatePerHourRate(4);

            Employee emp = new Employee();

            emp.FirstName = "Tim";
            emp.LastName  = "Corey";
            emp.AssignManager(accountingVP);
            emp.CalculatePerHourRate(2);

            Console.WriteLine($"{ emp.FirstName }'s salary is ${ emp.Salary }/hour.");

            Console.ReadLine();
        }
Beispiel #2
0
        public static void Main(string[] args)
        {
            IManager accountingVP = new CEO();

            accountingVP.FirstName = "E mma";
            accountingVP.LastName  = "Stone";
            accountingVP.CalculatePerHourRate(4);

            IManaged employee = new Employee();

            employee.FirstName = "Alex";
            employee.LastName  = "DC";
            employee.AssignManager(accountingVP);
            employee.CalculatePerHourRate(2);


            Console.WriteLine($"{ employee.FirstName }´s salary is ${ employee.Salary }/hour.");
            Console.ReadLine();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            IManager accountingVP = new CEO();

            accountingVP.FirstName = "Emma";
            accountingVP.LastName  = "Stone";
            accountingVP.CalculatePerHourRate(4);

            IManaged emp = new Employee();

            emp.FirstName = "Laurent";
            emp.LastName  = "Bajrami";
            emp.AssignManager(accountingVP);
            emp.CalculatePerHourRate(2);

            Console.WriteLine($"{ emp.FirstName}'s salary is ${ emp.Salary }/hour");

            Console.ReadLine();
        }
Beispiel #4
0
        // SO[L]ID - Liskovs Substitution Principle.
        // If S is subtype of T => T can be replaced with S, without breaking the program.
        static void Main(string[] args)
        {
            IManager accountingVP = new Manager
            {
                FirstName = "John",
                LastName  = "Doe",
            };

            accountingVP.CalculatePerHourRate(4);

            // IManager is a subtype of Employee => Employee can be replaced with IManager, without breaking the program.
            IManaged emp = new Employee {
                FirstName = "Manager",
                LastName  = "Johnsson"
            };

            emp.AssignManager(accountingVP);
            emp.CalculatePerHourRate(2);

            Console.WriteLine($"{emp.FirstName}'s salary is ${emp.Salary}/hour.");
            Console.ReadKey();
        }