S2T40.(深入.Net平台和C#编程)第四章.简答题4.刁汉生.20170406

 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using System.Threading.Tasks;
 6
 7 namespace 简答题.Entity
 8 {
 9     /// <summary>
10     /// 蚂蚁类
11     /// </summary>
12     public class Ant
13     {
14         //蚂蚁名字
15         public string Name { get; set; }
16         public Ant(string name)
17         {
18             this.Name = name;
19         }
20         /// <summary>
21         /// 问好方法
22         /// </summary>
23         public void SayHi()
24         {
25             Console.WriteLine("大家好!我是一只小蚂蚁,名字叫{0}",Name);
26         }
27         /// <summary>
28         /// 找甜品方法
29         /// </summary>
30         /// <param name="des"></param>
31
32         public void Find(Dessert des)
33         {
34             Console.WriteLine("我找到一块甜品:{0}",des.Name);
35         }
36         /// <summary>
37         /// 找伙伴方法
38         /// </summary>
39         /// <param name="count"></param>
40         public void FindPartner(int count)
41         {
42             Console.WriteLine("我招呼到{0}个同伴!",count);
43         }
44         /// <summary>
45         /// 工作方法
46         /// </summary>
47         public void Working()
48         {
49             Console.WriteLine("现在,大家搬运甜品");
50             Console.WriteLine("我们完成寻找甜品的任务!");
51         }
52
53     }
54 }

蚂蚁类

 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using System.Threading.Tasks;
 6
 7 namespace 简答题.Entity
 8 {
 9     /// <summary>
10     /// 甜品类
11     /// </summary>
12     public class Dessert
13     {
14         //甜品名
15         public string Name { get; set; }
16         public Dessert(string name)
17         {
18             this.Name = name;
19         }
20     }
21 }

甜品类

 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using System.Threading.Tasks;
 6 using 简答题.Entity;
 7
 8 namespace 简答题
 9 {
10     class Program
11     {
12         static void Main(string[] args)
13         {
14             Ant ant = new Ant("小不点");
15             ant.SayHi();
16             Dessert des = new Dessert("提拉米苏");
17             ant.Find(des);
18             ant.FindPartner(2);
19             ant.Working();
20             Console.ReadLine();
21         }
22     }
23 }

Main方法

时间: 2024-10-13 19:14:23

S2T40.(深入.Net平台和C#编程)第四章.简答题4.刁汉生.20170406的相关文章

S2T40.(深入.Net平台和C#编程)第四章.简答题5.刁汉生.20170406

1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Threading.Tasks; 6 7 namespace 简答题5.Entity 8 { 9 /// <summary> 10 /// 巫师类 11 /// </summary> 12 public class Wizard 13 { 14 /// <sum

S2T40.(深入.Net平台和C#编程)第四章.简答题4.李向阳.20170406

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&

S2T40.(深入.Net平台和C#编程)第四章.简答题4、5.何强.20170406

简答题4: 简答题5

S2T40.(深入.Net平台和C#编程)第四章.简答题5.李向阳.20170406

---恢复内容开始--- 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 J5.entity 9 { 10 /// <summary> 11 ///巫师类 12 /// </summary>

(深入.Net平台和C#编程)第六章.简答题3.20170410

---------------------------------------父类Animals类--------------------------------------- 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Threading.Tasks; 6 7 namespace JD.entity 8 { 9 /// <

S2T40深入.NET平台和C#编程简答题52017-4-6

public  class powwow    { //姓名        private string name;        public string Name        {            get { return name;}            set { name = value;}        } //生命值 private int blood; public int Blood { get { return blood;} set { blood = value

(深入.Net平台和C#编程)第六章.上机练习2.20170410

----------父类---------- 1 using Lesson6.上机练习2.enums; 2 using System; 3 using System.Collections.Generic; 4 using System.Linq; 5 using System.Text; 6 using System.Threading.Tasks; 7 8 namespace Lesson6.上机练习2 9 { 10 /// <summary> 11 /// 父类 12 /// </

(深入.Net平台和C#编程)第七章-深入理解多态.上机练习.20170412

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 Sj2.Entity 9 { 10 /// <summary> 11 ///父类 :工作类 12 /// </summary&

(深入.Net平台和C#编程)第六章.上机练习4.20170410

---------------------------------------------------父类--------------------------------------------------- 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Threading.Tasks; 6 7 namespace Calc.