예제 #1
0
        static void Main(string[] args)
        {
            Camera   pentax   = new Camera("Pentax");
            Bowgun   pistol   = new Bowgun("SuperSoaker", "WaterPistol", 0);
            LaserGun laserGun = new LaserGun("Acme", "LaserGun", 5);
            Hunter   nish     = new Hunter("Nish", "Mandal", pentax);

            Console.WriteLine(nish.Shoot());
            nish.Shooter = pistol;
            Console.WriteLine(nish.Shoot());
            nish.Shooter = laserGun;
            Console.WriteLine(nish.Shoot());
            nish.Shooter = pistol;
            Console.WriteLine(nish.Shoot());



            // LaserGun LaserRifle = new LaserGun("Laser Rifle", "Laser Gun", 1);
            // MonsterHunter Bryn = new MonsterHunter("Bryn", "Morley", "Sony",LaserRifle) {Age = 24};
            //// Person Nish = new Person("Nish", "Mandal") { Age = 30 };

            // Monster Rathalos = new Monster("Rathalos",10);
            // Monster Kirin = new Monster("Kirin",25) { IsElderDragon = true };

            // Ranged Shooter = new Ranged("Shooter", "Gun", 1);

            // Console.WriteLine(LaserRifle.Shoot());
            // Console.WriteLine(Shooter.Shoot());

            // Console.WriteLine(Bryn);
            // Console.WriteLine();
            // for (int i = 0; i < 10; i++)
            // {
            //     Console.WriteLine(Bryn.Attack(Rathalos));
            // }



            // Console.WriteLine(Bryn.Capture(Rathalos));
            // Console.WriteLine(Bryn.Capture(Kirin));
            // Console.WriteLine();
            // //for (int i = 0; i < 30; i++)
            // //{
            // //    Console.WriteLine(Bryn.Capture(Rathalos));
            // //}

            // Console.WriteLine();
            // Console.WriteLine();
        }
예제 #2
0
        static void Main(string[] args)
        {
            Airplane a = new Airplane(200, 100, "JetsRUs")
            {
                NumPassengers = 150
            };

            a.Ascend(500);
            a.Move(3);
            a.Descend(200);
            Console.WriteLine(a);


            Hunter h = new Hunter("Vinay", "Patel")
            {
                Age = 24
            };
            Hunter h2 = new Hunter("Fazal", "Cheema")
            {
                Age = 23
            };

            Console.WriteLine(h);


            //Console.WriteLine($"h HashCode:{h.GetHashCode()}");
            //Console.WriteLine($"h Equals h2?:{h.Equals(h2)}");
            //Console.WriteLine($"h type:{h.GetType()}");
            //Console.WriteLine($"h ToString:{h.ToString()}");

            //Person cathy = new Person("Cathy", "French");
            //Console.WriteLine(cathy.Age);
            //cathy.Age = 22;
            //Console.WriteLine(cathy.Age);

            //Console.WriteLine(cathy.GetFullName());

            //Person nish;
            //nish = new Person("Nish", "Mandal");
            //Console.WriteLine(nish.GetFullName());

            //public Person () //
            //{
            //    Person fazal = new Person();
            //    fazal.Age = 12;
            //    fazal._lastname = "sadsd" //can't because private
            //}

            // boxing
            //int i = 123;
            //object o = i;

            //structs
            //Public struct Point3D
            //{
            //    Public int x, y, z;
            //    Public Point3D(int x, int y, int z)
            //    {
            //        this.x = x;
            //        this.y = y;
            //        this.z = z;
            //    }
            //}
        }