Exemplo n.º 1
0
        void CheckTypes()
        {
            Phone phone = null;

            Console.WriteLine("what is the phone that you want???");
            string choice = Console.ReadLine().ToLower();

            switch (choice)
            {
            case "phone":
                phone = new Phone();
                break;

            case "smartphone":
                phone = new SmartPhone();
                break;

            case "satillite":
                phone = new SatillitePhone();
                break;

            default:
                //phone = new Phone();
                Console.WriteLine("Invalid phone type");
                break;
            }
            UsePhone(phone);
        }
Exemplo n.º 2
0
        void CreatePhone()
        {
            Phone iPhoneXI = new SmartPhone();//Every SmartPhone is phone
            //SmartPhone iPhoneX = new Phone();//Every Phone is not a smartphone
            //iPhoneXI.Charge();
            SatillitePhone sp = new SatillitePhone();//Satillite Phone is also a phone

            sp.Color         = "Black";
            sp.RingingVolume = 1;
            sp.Ring();
            sp.ReceiveCall("9876543210");
            sp.MakeCallFromAnywhere();
            //iPhoneXI.RingingVolume = 8;
            //iPhoneXI.Color = "Red";
            //iPhoneXI.Charge();
            //iPhoneXI.CarryPhone();
            //iPhoneXI.MakeCall("Mom");
            //iPhoneXI.Ring();
            //iPhoneXI.ReceiveCall("1234567890");
            //iPhoneXI.PlayGame();
            //iPhoneXI.WhatsApping();
        }