Exemple #1
0
        static void Main(string[] args)
        {
            var myBike = new Zero();

            // i can still refrence the inherited properity
            myBike.Name             = "Zero";
            myBike.MainColor        = "Midnight Black";
            myBike.MaximumOccupancy = 2;

            var myTesla = new Tesla();

            myTesla.Name             = "Tesla";
            myTesla.MainColor        = "Space Gray";
            myTesla.MaximumOccupancy = 5;

            var myRam = new Ram();

            myRam.Name             = "Ram";
            myRam.MainColor        = "Rocket Red";
            myRam.MaximumOccupancy = 5;

            var myCessna = new Cessna();

            myCessna.Name             = "Cessna";
            myCessna.MainColor        = "Blue and White";
            myCessna.MaximumOccupancy = 8;

            myBike.Drive();
            myBike.Turn();
            myBike.stop();

            Console.WriteLine("-------------------------------------");

            myTesla.Drive();
            myTesla.Turn();
            myTesla.stop();

            Console.WriteLine("-------------------------------------");

            myRam.Drive();
            myRam.Turn();
            myRam.stop();

            Console.WriteLine("-------------------------------------");

            myCessna.Drive();
            myCessna.Turn();
            myCessna.stop();

            double price = 15.00;

            Console.WriteLine(price.ToString("C"));
        }
Exemple #2
0
        static void Main(string[] args)
        {
            var zero   = new Zero();
            var tesla  = new Tesla();
            var cessna = new Cessna();
            var ram    = new Ram();

            zero.MainColor         = "White";
            tesla.MaximumOccupancy = 5;

            zero.Drive();
            tesla.Drive();
            cessna.Drive();
            ram.Drive();
        }
Exemple #3
0
        static void Main(string[] args)
        {
            var myBike = new Zero();

            //I can still reference the inherited class
            myBike.MainColor    = "Black";
            myBike.MaxOccupancy = 2;
            myBike.Name         = "Zero";

            var myTesla = new Tesla();

            myTesla.MainColor    = "Midnight Silver";
            myTesla.MaxOccupancy = 6;
            myTesla.Name         = "Tesla";

            var myRam = new Ram();

            myRam.MainColor    = "blue";
            myRam.Name         = "Ram";
            myRam.MaxOccupancy = 5;

            var myCessna = new Cessna();

            myCessna.MainColor    = "green";
            myCessna.Name         = "Cessna";
            myCessna.MaxOccupancy = 10;

            myBike.Drive();
            myTesla.Drive();
            myCessna.Drive();
            myRam.Drive();

            myBike.Turn("taking a left");
            myBike.Stop();

            myTesla.Turn("taking a right");
            myTesla.Stop();

            myRam.Turn("taking several wrong turns");
            myRam.Stop();

            myCessna.Turn("doing loops!");
            myCessna.Stop();
        }
Exemple #4
0
        static void Main(string[] args)
        {
            var myBike = new Zero();

            // I can still reference the inherited property
            myBike.MainColor    = "Black";
            myBike.MaxOccupancy = 2;

            var myTesla = new Tesla();

            myTesla.MainColor    = "Midnight Silver";
            myTesla.MaxOccupancy = 6;

            var myRam = new Ram();

            myRam.MainColor = "Black as midnight on a moonless night";

            var myCessna = new Cessna();

            myCessna.MainColor = "Drug runner White";

            myBike.Drive();
            myBike.Turn();
            myBike.Stop();

            myTesla.Drive();
            myTesla.Turn();
            myTesla.Stop();

            myRam.Drive();
            myRam.Turn();
            myRam.Stop();

            myCessna.Drive();
            myCessna.Turn();
            myCessna.Stop();

            Console.WriteLine(myTesla);

            double price = 15.50;

            Console.WriteLine(price.ToString("C"));
        }
Exemple #5
0
        static void Main(string[] args)
        {
            var myBike = new Zero();

            // I can still refer to the inherited property
            myBike.MainColor     = "Black";
            myBike.MaxOccupancey = 2;

            var myTesla = new Tesla();

            myTesla.MainColor     = "Midnight Silver";
            myTesla.MaxOccupancey = 6;

            var myRam = new Ram();

            myRam.MainColor     = "Candy Apple Red";
            myRam.MaxOccupancey = 5;

            var myCessna = new Cessna();

            myCessna.MainColor     = "Olive Green";
            myCessna.MaxOccupancey = 4;

            myBike.Drive();
            myBike.Turn();
            myBike.Stop();
            myTesla.Drive();
            myTesla.Turn();
            myTesla.Stop();
            myRam.Drive();
            myRam.Turn();
            myRam.Stop();
            myCessna.Drive();
            myCessna.Turn();
            myCessna.Stop();
        }