S2t40. Depth. NET platform and C # programming) Chapter fourth. Brief answer 4. Lixiangyang. 20170406

Source: Internet
Author: User

1=================== Ant class ===============2 usingSystem;3 usingSystem.Collections.Generic;4 usingSystem.Linq;5 usingSystem.Text;6 usingSystem.Threading.Tasks;7 8 namespacekehouzuye.entity9 {Ten     /// <summary> One     ///Ant class A     /// </summary> -      Public  classME -     { the          Public stringName {Get;Set; } -  -          PublicME (stringname) -         { +              This. Name =name; -         } +         /// <summary> A         ///Say hello at         /// </summary> -          Public voidSayhai () -         { -Console.WriteLine ("Hello, my name is"+Name); -         } -  in         /// <summary> -         ///Find Dessert to         /// </summary> +          Public voidTp (tianpin foop) -         { theConsole.WriteLine ("I found a piece of dessert:"+Foop. Tpname); *         } $         /// <summary>Panax Notoginseng         ///Greeting Partners -         /// </summary> the          Public voidCount (intCount) +         { AConsole.WriteLine ("I greeted"+ Count +"a partner! "); the         } +         /// <summary> -         ///Handling Desserts $         /// </summary> $          Public voidGood () -         { -Console.WriteLine ("Now, everyone begins to carry dessert! "); theConsole.WriteLine ("We finish our quest for dessert."); -Console.WriteLine ("Press any key to exit the------");Wuyi         } the     } -}
View Code
1============= Sweet category ==============2 usingSystem;3 usingSystem.Collections.Generic;4 usingSystem.Linq;5 usingSystem.Text;6 usingSystem.Threading.Tasks;7 8 namespacekehouzuye.entity9 {Ten       Public  classTianpin One     { A          Public stringTpname {Get;Set; } -  -          PublicTianpin (stringname) the         { -              This. Tpname =name; -         } -     } +}
View Code
============= Test Class ==========usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;usingkehouzuye.entity;namespacekehouzuye{ Public  classProgram {Static voidMain (string[] args) {Me me=NewME ("Tiny"); Me.            Sayhai (); Tianpin TP=NewTianpin ("Tiramisu"); Me.            TP (TP); Me. Count (2); Me.            Good ();        Console.read (); }                 }}

S2t40. Depth. NET platform and C # programming) Chapter fourth. Brief answer 4. Lixiangyang. 20170406

Related Article

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.