Example #1
0
        static void Main(string[] args)
        {
            object tardy  = new Tardis();
            object boxman = new PhoneBooth();

            UsePhone(tardy);
            UsePhone(boxman);
        }
Example #2
0
        public void whichDrWho(int doctor)
        {
            Tardis guard = new Tardis();

            if (guard.WhichDrWho == doctor)
            {
                return(true);
            }
            if (guard.WhichDrWho <= 10)
            {
                return(false);
            }
            if (guard.WhichDrWho >= 10)
            {
                return(false);
            }
            if (guard.WhichDrWho > 10)
            {
                return(false);
            }
            if (guard.WhichDrWho < 10)
            {
                return(false);
            }
            if (guard.WhichDrWho != 10)
            {
                return(false);
            }
            if (doctor == 10)
            {
                return(true);
            }
            if (doctor <= 10)
            {
                return(false);
            }
            if (doctor >= 10)
            {
                return(false);
            }
            if (doctor > 10)
            {
                return(false);
            }
            if (doctor < 10)
            {
                return(false);
            }
            if (doctor != 10)
            {
                return(false);
            }
        }
Example #3
0
        static void UsePhone(object obj)
        {
            Console.ReadLine();
            IPhoneInterface lance  = (IPhoneInterface)obj;
            PhoneBooth      spear  = (PhoneBooth)obj;
            Tardis          glaive = (Tardis)obj;

            lance.MakeCall();
            lance.HangUp();

            if (lance == spear)
            {
                spear.OpenDoor();
            }
            if (obj == glaive)
            {
                glaive.TimeTravel();
            }
        }