示例#1
0
        private void btnAnyCar_Click(object sender, EventArgs e)
        {
            Automobile myAuto = new Automobile();
            Automobile myOtherAuto = new Car();
            Automobile myOtherAutoT = new Truck();
            Automobile myOtherAutoS = new SUV();

            myAuto.Price = 100M;
            myAuto.Mileage = 10;
            myAuto.StartEngine();

            myOtherAutoS.Make = "New SUV!";
            myOtherAutoS.Mileage = 12;
            myOtherAutoS.Price = 22000M;
            myOtherAutoS.StartEngine();
            myOtherAutoS.ShowInfo();

            myOtherAuto.StartEngine();
            myOtherAutoT.Price = 100000M;
            myOtherAutoT.Mileage = 10;
            myAuto.ShowInfo();
            myOtherAutoT.ShowInfo();

            //tryStartingAgain(myAuto);
            //tryStartingAgain(myOtherAuto);

            //Car coolCar = (Car) new Automobile();
            //MessageBox.Show("Test: " + myOtherAuto.Doors);
            //Cannot access
        }
示例#2
0
        private void btnAnyCar_Click(object sender, EventArgs e)
        {
            Automobile myAuto       = new Automobile();
            Automobile myOtherAuto  = new Car();
            Automobile myOtherAutoT = new Truck();
            Automobile myOtherAutoS = new SUV();

            myAuto.Price   = 100M;
            myAuto.Mileage = 10;
            myAuto.StartEngine();

            myOtherAutoS.Make    = "New SUV!";
            myOtherAutoS.Mileage = 12;
            myOtherAutoS.Price   = 22000M;
            myOtherAutoS.StartEngine();
            myOtherAutoS.ShowInfo();


            myOtherAuto.StartEngine();
            myOtherAutoT.Price   = 100000M;
            myOtherAutoT.Mileage = 10;
            myAuto.ShowInfo();
            myOtherAutoT.ShowInfo();

            //tryStartingAgain(myAuto);
            //tryStartingAgain(myOtherAuto);


            //Car coolCar = (Car) new Automobile();
            //MessageBox.Show("Test: " + myOtherAuto.Doors);
            //Cannot access
        }
示例#3
0
 private void tryStartingAgain(Automobile auto)
 {
     auto.StartEngine();
 }
示例#4
0
 private void tryStartingAgain(Automobile auto)
 {
     auto.StartEngine();
 }