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

            danny.Age = 31;
            danny.Name = "Danny";
            danny.SalesNumber = 50;

            Manager chucky = new Manager("Chucky", 50, 92, 100000, "333-23-2322", 9000);

            chucky.GiveBonus(300);

            double cost = chucky.GetBenefitCost();

            chucky.DisplayStats();

            Console.WriteLine("Benefícios: {0}", cost);

            Employee.BenefitPackage.BenefitPackageLevel myBenefitLevel = Employee.BenefitPackage.BenefitPackageLevel.Platinum;

            Console.WriteLine("Level: {0}", myBenefitLevel);

            SalesPerson fran = new SalesPerson("Fran", 43, 93, 3000, "932-32-3232", 31);

            fran.GiveBonus(200);

            fran.DisplayStats();

            try
            {

                PTSalesPerson ptSales = ((PTSalesPerson)danny);
            }
            catch (InvalidCastException ex)
            {
                Console.WriteLine(ex.Message);
            }

            PTSalesPerson ptCast = danny as PTSalesPerson;

            if (ptCast == null)
            {
                Console.WriteLine("Sorry, danny is not PTSalesPerson");
            }

            Console.WriteLine(danny.ToString() + "&&" + danny.GetType());

            Console.ReadLine();
        }