标签:namespace style name summary 分享 div log pac oid
1 ===================蚂蚁类=============== 2 using System; 3 using System.Collections.Generic; 4 using System.Linq; 5 using System.Text; 6 using System.Threading.Tasks; 7 8 namespace KeHouZuYe.entity 9 { 10 /// <summary> 11 /// 蚂蚁类 12 /// </summary> 13 public class ME 14 { 15 public string Name { get; set; } 16 17 public ME(string name) 18 { 19 this.Name = name; 20 } 21 /// <summary> 22 /// 问好 23 /// </summary> 24 public void SayHai() 25 { 26 Console.WriteLine("大家好,我叫"+Name); 27 } 28 29 /// <summary> 30 /// 找甜品 31 /// </summary> 32 public void Tp(Tianpin foop ) 33 { 34 Console.WriteLine("我找到一块甜品:"+foop.TpName); 35 } 36 /// <summary> 37 /// 招呼伙伴 38 /// </summary> 39 public void Count(int Count) 40 { 41 Console.WriteLine("我招呼到" + Count + "个伙伴!"); 42 } 43 /// <summary> 44 /// 搬运甜品 45 /// </summary> 46 public void Good() 47 { 48 Console.WriteLine("现在,大家开始搬运甜品!"); 49 Console.WriteLine("我们完成寻找甜品的任务"); 50 Console.WriteLine("按任意键退出------"); 51 } 52 } 53 }
1 =============甜品类============== 2 using System; 3 using System.Collections.Generic; 4 using System.Linq; 5 using System.Text; 6 using System.Threading.Tasks; 7 8 namespace KeHouZuYe.entity 9 { 10 public class Tianpin 11 { 12 public string TpName { get; set; } 13 14 public Tianpin(string name) 15 { 16 this.TpName = name; 17 } 18 } 19 }
=============测试类========== using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using KeHouZuYe.entity; namespace KeHouZuYe { public class Program { static void Main(string[] args) { ME me = new ME("小不点"); me.SayHai(); Tianpin tp = new Tianpin("提拉米苏"); me.Tp(tp); me.Count(2); me.Good(); Console.Read(); } } }
S2T40.(深入.Net平台和C#编程)第四章.简答题4.李向阳.20170406
标签:namespace style name summary 分享 div log pac oid
原文地址:http://www.cnblogs.com/qq2835200767/p/6676201.html