コード例 #1
0
ファイル: Program.cs プロジェクト: dhaverka/Module07Dale
        static void Main(string[] args)
        {
            Automobile myAutomobile = new Module07Dale.AutoDealer.Automobile();

            // write properties of constructor

            WriteLine("My automobile is a classy {0} {1} that was built in the year {2}. \nThe color is {3} and the engine type is {4}.",
                      myAutomobile.AutoMake,
                      myAutomobile.AutoModel,
                      myAutomobile.AutoYear,
                      myAutomobile.AutoColor,
                      myAutomobile.AutoEngine);

            Automobile my2ndAutomobile = new Automobile("GMC");

            // write property of overloaded constructor
            WriteLine("\nMy 2nd automobile is an overloaded {0}.  \nI should go unload the {0}.  \nI have not handled the {0} responsibly.\n",
                      my2ndAutomobile.AutoMake);

            // static method example called
            Automobile.AutomobileExampleStatic();

            // nonstatic method example called;

            myAutomobile.AutomobileExampleNonStatic();

            // create 2 more different objects - assignment step .e
            Automobile myCar      = new Automobile("Pontiac");
            Automobile myOtherCar = new Automobile();

            WriteLine("\nMy car and my other car were:");

            WriteLine("{0}", myCar.AutoMake);
            WriteLine("{0}", myOtherCar.AutoMake);

            // reassign values in myCar and myOtherCar
            myCar.AutoMake      = "Ford";
            myOtherCar.AutoMake = "Cadillac";

            WriteLine("\nTraded my car and my other car for");

            WriteLine("{0}", myCar.AutoMake);
            WriteLine("{0}", myOtherCar.AutoMake);


            ReadLine();
        }