public ICricketer GetCricketer(CricketerBase cricketerBase)
        {
            ICricketer objICricketer = null;

            switch (cricketerBase)
            {
            case CricketerBase.EnglishCricketer:
                objICricketer = new EnglishCricketer();
                break;

            default:
                break;
            }
            return(objICricketer);
        }
Ejemplo n.º 2
0
        public ICricketer GetCricketer(CricketerBase cricketerBase)
        {
            ICricketer objICricketer = null;

            switch (cricketerBase)
            {
            case CricketerBase.BangladeshiCricketer:
                objICricketer = new BangladeshiCricketer();
                break;

            case CricketerBase.IndianCricketer:
                objICricketer = new IndianCricketer();
                break;

            default:
                break;
            }
            return(objICricketer);
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            AsianCricketerFactory objAsianFactory    = new AsianCricketerFactory();
            ICricketer            objIAsianCricketer = objAsianFactory.GetCricketer(CricketerBase.BangladeshiCricketer);

            Console.WriteLine("Bangladesh Cricket Team\nBatting Strength:" + objIAsianCricketer.BattingStrength());
            Console.WriteLine("Bowling Strength:" + objIAsianCricketer.BowlingStrength());
            Console.WriteLine("Allrounding Strength:" + objIAsianCricketer.AllroundingStrength());
            Console.WriteLine("Icon Player:" + objIAsianCricketer.IconPlayer());

            Console.WriteLine();

            EuropeanCricketerFactory objEuropeanFactory = new EuropeanCricketerFactory();
            ICricketer objIEuropeanCricketer            = objEuropeanFactory.GetCricketer(CricketerBase.EnglishCricketer);

            Console.WriteLine("England Cricket Team\nBatting Strength:" + objIEuropeanCricketer.BattingStrength());

            Console.WriteLine("Bowling Strength:" + objIEuropeanCricketer.BowlingStrength());
            Console.WriteLine("Allrounding Strength:" + objIEuropeanCricketer.AllroundingStrength());
            Console.WriteLine("Icon Player:" + objIEuropeanCricketer.IconPlayer());


            Console.ReadLine();
        }