Depth. NET platform and C # programming) chapter sixth on-machine Exercise 1. Lixiangyang. 20170411

Source: Internet
Author: User

1=============truck class ==========2 usingSystem;3 usingSystem.Collections.Generic;4 usingSystem.Linq;5 usingSystem.Text;6 usingSystem.Threading.Tasks;7 8 namespacesj1.entity9 {Ten     /// <summary> One     ///Truck Class A     /// </summary> -      Public classtruck:vehicle -     { the         PublicTruck (stringXinghao,stringChandi):Base(Xinghao,chandi) -        {} -        /// <summary> -        ///Truckrun () +        /// </summary> -         Public voidTruckrun () +        { AConsole.WriteLine (string. Format ("The model number is: {0}, the truck where the origin is {1} is driving! ", Xinghao,chandi)); at        } -     } -  -}
View Code
1=============vehicle class ==============2 usingSystem;3 usingSystem.Collections.Generic;4 usingSystem.Linq;5 usingSystem.Text;6 usingSystem.Threading.Tasks;7 8 namespacesj1.entity9 {Ten     /// <summary> One     ///Automobile class A     /// </summary> -      Public classVehicle -     { the          Public stringXinghao {Get;Set; }//Model -          Public stringChandi {Get;Set; }//Origin -         /// <summary> -         ///constructor Function +         /// </summary> -         /// <param name= "Xinghao" ></param> +         /// <param name= "Chandi" ></param> A          PublicVehicle (stringXinghao,stringChandi) at         { -              This. Xinghao =Xinghao; -              This. Chandi =Chandi; -         } -         /// <summary> -         ///Vehiclrun () method in         /// </summary> -          Public voidVehiclerun () to         { +Console.WriteLine ("the car is driving"); -         } the     } *}
View Code
1============= Test Class ==============2 usingsj1.entity;3 usingSystem;4 usingSystem.Collections.Generic;5 usingSystem.Linq;6 usingSystem.Text;7 usingSystem.Threading.Tasks;8 9 namespaceSJ1Ten { One     class Program A     { -         Static voidMain (string[] args) -         { theTruck Truck =NewTruck ("Audi A6","Germany"); - truck. Truckrun (); - truck. Vehiclerun (); - Console.read (); +  -         } +     } A}
View Code

Depth. NET platform and C # programming) chapter sixth on-machine Exercise 1. Lixiangyang. 20170411

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.