From 78854c471ede55a5ee5923efea36c7b7d649239a Mon Sep 17 00:00:00 2001 From: tan1 <3118123975@qq.com> Date: Wed, 26 May 2021 10:52:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B9=E6=96=87=E6=96=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\345\212\250\347\211\251/Cat.cs" | 33 ++++++++++ .../\345\212\250\347\211\251/Dog.cs" | 37 +++++++++++ .../\345\212\250\347\211\251/Duck.cs" | 31 +++++++++ .../\345\212\250\347\211\251/Monkey.cs" | 34 ++++++++++ .../\345\212\250\347\211\251/Program.cs" | 65 +++++++++++++++++++ .../\347\224\265\350\204\221/Computer.cs" | 52 +++++++++++++++ .../\347\224\265\350\204\221/Father.cs" | 26 ++++++++ .../\347\224\265\350\204\221/Hdisk.cs" | 25 +++++++ .../\347\224\265\350\204\221/Program.cs" | 39 +++++++++++ .../\347\224\265\350\204\221/Udisk.cs" | 25 +++++++ .../Animal.cs" | 24 +++++++ .../Bird.cs" | 38 +++++++++++ .../Plane.cs" | 40 ++++++++++++ .../Program.cs" | 39 +++++++++++ .../Surperman.cs" | 34 ++++++++++ 15 files changed, 542 insertions(+) create mode 100644 "\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\345\212\250\347\211\251/Cat.cs" create mode 100644 "\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\345\212\250\347\211\251/Dog.cs" create mode 100644 "\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\345\212\250\347\211\251/Duck.cs" create mode 100644 "\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\345\212\250\347\211\251/Monkey.cs" create mode 100644 "\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\345\212\250\347\211\251/Program.cs" create mode 100644 "\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\347\224\265\350\204\221/Computer.cs" create mode 100644 "\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\347\224\265\350\204\221/Father.cs" create mode 100644 "\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\347\224\265\350\204\221/Hdisk.cs" create mode 100644 "\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\347\224\265\350\204\221/Program.cs" create mode 100644 "\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\347\224\265\350\204\221/Udisk.cs" create mode 100644 "\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\351\243\236\346\234\272\350\266\205\344\272\272/Animal.cs" create mode 100644 "\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\351\243\236\346\234\272\350\266\205\344\272\272/Bird.cs" create mode 100644 "\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\351\243\236\346\234\272\350\266\205\344\272\272/Plane.cs" create mode 100644 "\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\351\243\236\346\234\272\350\266\205\344\272\272/Program.cs" create mode 100644 "\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\351\243\236\346\234\272\350\266\205\344\272\272/Surperman.cs" diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\345\212\250\347\211\251/Cat.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\345\212\250\347\211\251/Cat.cs" new file mode 100644 index 0000000..11e4c03 --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\345\212\250\347\211\251/Cat.cs" @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConsoleApp1 +{ + class Cat:IEat,IClimbing + { + private string name; + public string Name + { + get { return this.name; } + set { this.name = value; } + } + public Cat(string name) + { + this.name = name; + } + + public void Climbing() + { + Console.WriteLine("{0}会爬树", this.name); + } + + public void Eat() + { + Console.WriteLine("{0}会吃",this.name); + } + + } +} diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\345\212\250\347\211\251/Dog.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\345\212\250\347\211\251/Dog.cs" new file mode 100644 index 0000000..8a93b3b --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\345\212\250\347\211\251/Dog.cs" @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConsoleApp1 +{ + class Dog : IEat, IClimbing,ISwim + { + private string name; + public string Name + { + get { return this.name; } + set { this.name = value; } + } + public Dog(string name) + { + this.name = name; + } + + public void Climbing() + { + Console.WriteLine("{0}会爬树", this.name); + } + + public void Eat() + { + Console.WriteLine("{0}会吃", this.name); + } + + public void Swim() + { + Console.WriteLine("{0}会游泳", this.name); + } + } +} diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\345\212\250\347\211\251/Duck.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\345\212\250\347\211\251/Duck.cs" new file mode 100644 index 0000000..0508af1 --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\345\212\250\347\211\251/Duck.cs" @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConsoleApp1 +{ + class Duck : IEat, ISwim + { + private string name; + public string Name + { + get { return this.name; } + set { this.name = value; } + } + public Duck(string name) + { + this.name = name; + } + public void Eat() + { + Console.WriteLine("{0}会吃", this.name); + } + + public void Swim() + { + Console.WriteLine("{0}会游泳", this.name); + } + } +} diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\345\212\250\347\211\251/Monkey.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\345\212\250\347\211\251/Monkey.cs" new file mode 100644 index 0000000..d2782dd --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\345\212\250\347\211\251/Monkey.cs" @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConsoleApp1 +{ + class Monkey : IEat, IClimbing + { + private string name; + public string Name + { + get { return this.name; } + set { this.name = value; } + } + public Monkey(string name) + { + this.name = name; + } + + public void Climbing() + { + Console.WriteLine("{0}会爬树", this.name); + } + + public void Eat() + { + Console.WriteLine("{0}会吃", this.name); + } + + } +} + diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\345\212\250\347\211\251/Program.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\345\212\250\347\211\251/Program.cs" new file mode 100644 index 0000000..7552377 --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\345\212\250\347\211\251/Program.cs" @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConsoleApp1 +{//1、猫、狗、鸭、猴,(吃、游泳、爬树) + class Program + { + static void Main() + { + Cat c = new Cat("猫"); + Test(c); + + Console.WriteLine(); + Dog d = new Dog("狗"); + Test1(d); + + + Console.WriteLine(); + Duck du = new Duck("鸭"); + Test2(du); + + Console.WriteLine(); + Monkey m = new Monkey("猴"); + Test3(m); + } + static void Test(Cat c) + { + c.Eat(); + c.Climbing(); + + } + static void Test1(Dog d) + { + d.Climbing(); + d.Eat(); + + } + static void Test2(Duck d) + { + d.Swim(); + d.Eat(); + } + static void Test3(Monkey m) + { + m.Climbing(); + m.Eat(); + + } + } + interface IEat + { + void Eat(); + } + interface ISwim + { + void Swim(); + } + interface IClimbing + { + void Climbing(); + } +} diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\347\224\265\350\204\221/Computer.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\347\224\265\350\204\221/Computer.cs" new file mode 100644 index 0000000..ee3739d --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\347\224\265\350\204\221/Computer.cs" @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConsoleApp2 +{ + class Computer + { + private string brond; + private Usb usb1; + private Usb usb2; + public string Brond + { + get { return this.brond; } + set { this.brond = value; } + } + internal Usb Usb1 + { + get { return this.usb1; } + set { this.usb1 = value; } + } + internal Usb Usb2 + { + get { return this.usb2; } + set { this.usb2 = value; } + } + public Computer(string brond) + { + this.Brond = brond; + } + public void Info() + { + Console.WriteLine("{0}开机中",this.brond); + } + public void Read1() + { + this.usb1.read(); + this.usb2.read(); + } + public void Write1() + { + this.usb1.write(); + this.usb2.write(); + } + public void End() + { + Console.WriteLine("{0}关机中"); + } + } +} diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\347\224\265\350\204\221/Father.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\347\224\265\350\204\221/Father.cs" new file mode 100644 index 0000000..4ececac --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\347\224\265\350\204\221/Father.cs" @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConsoleApp2 +{ + class Father + { + private string brond; + public string Brond + { + get { return this.brond; } + set { this.brond = value; } + } + public Father(string brond) + { + this.brond = brond; + } + public void Info() + { + Console.WriteLine("{0}",this.brond); + } + } +} diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\347\224\265\350\204\221/Hdisk.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\347\224\265\350\204\221/Hdisk.cs" new file mode 100644 index 0000000..7fc9235 --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\347\224\265\350\204\221/Hdisk.cs" @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConsoleApp2 +{ + class Hdisk : Father, Usb + { + public Hdisk(string brond) : base(brond) + { + this.Brond = brond; + } + public void read() + { + Console.WriteLine("硬盘正在读取"); + } + + public void write() + { + Console.WriteLine("硬盘正在写入"); + } + } +} diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\347\224\265\350\204\221/Program.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\347\224\265\350\204\221/Program.cs" new file mode 100644 index 0000000..26f7686 --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\347\224\265\350\204\221/Program.cs" @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConsoleApp2 +{ + class Program + { + static void Main(string[] args) + { + Hdisk h = new Hdisk("东芝"); + h.Info(); + h.read(); + h.write(); + + Udisk u = new Udisk("金士顿"); + u.Info(); + u.read(); + u.write(); + + Computer c = new Computer("联想"); + c.Info(); + c.Usb1 = h; + c.Usb2 = u; + c.Read1(); + + c.Write1(); + c.End(); + } + } + + interface Usb + { + void read(); + void write(); + } +} diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\347\224\265\350\204\221/Udisk.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\347\224\265\350\204\221/Udisk.cs" new file mode 100644 index 0000000..8a3f6f6 --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\347\224\265\350\204\221/Udisk.cs" @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConsoleApp2 +{ + class Udisk:Father,Usb + { + public Udisk(string brond) : base(brond) + { + this.Brond = brond; + } + public void read() + { + Console.WriteLine("u盘正在读取"); + } + + public void write() + { + Console.WriteLine("u盘正在写入"); + } + } +} diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\351\243\236\346\234\272\350\266\205\344\272\272/Animal.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\351\243\236\346\234\272\350\266\205\344\272\272/Animal.cs" new file mode 100644 index 0000000..38248ba --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\351\243\236\346\234\272\350\266\205\344\272\272/Animal.cs" @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConsoleApp3 +{ + abstract class Animal + { + private string name; + public string Name + { + get { return this.name; } + set { this.name = value; } + } + public Animal(string name) + { + this.name = name; + } + public abstract void Eat(); + + } +} diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\351\243\236\346\234\272\350\266\205\344\272\272/Bird.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\351\243\236\346\234\272\350\266\205\344\272\272/Bird.cs" new file mode 100644 index 0000000..83be8e3 --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\351\243\236\346\234\272\350\266\205\344\272\272/Bird.cs" @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConsoleApp3 +{ + class Bird:Animal,IFlyable + { + public Bird(string name) : base(name) + { + } + public override void Eat() + { + Console.WriteLine("{0}会吃",this.Name); + } + + public void Fly() + { + Console.WriteLine("{0}会飞", this.Name); + } + + public void Land() + { + Console.WriteLine("{0}会着陆", this.Name); + } + + public void TakeOff() + { + Console.WriteLine("{0}会起飞", this.Name); + } + public void LayEggs() + { + Console.WriteLine("{0}会下蛋", this.Name); + } + } +} diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\351\243\236\346\234\272\350\266\205\344\272\272/Plane.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\351\243\236\346\234\272\350\266\205\344\272\272/Plane.cs" new file mode 100644 index 0000000..f8321b4 --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\351\243\236\346\234\272\350\266\205\344\272\272/Plane.cs" @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConsoleApp3 +{ + class Plane : IFlyable + { + private string name; + public string Name + { + get { return this.name; } + set { this.name = value; } + } + public Plane(string name) + { + this.name = name; + } + public void Fly() + { + Console.WriteLine("{0}会飞", this.Name); + } + + public void Land() + { + Console.WriteLine("{0}会着陆", this.Name); + } + + public void TakeOff() + { + Console.WriteLine("{0}会起飞", this.Name); + } + public void CarryPassange() + { + Console.WriteLine("{0}会托运行李", this.Name); + } + } +} diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\351\243\236\346\234\272\350\266\205\344\272\272/Program.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\351\243\236\346\234\272\350\266\205\344\272\272/Program.cs" new file mode 100644 index 0000000..033323b --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\351\243\236\346\234\272\350\266\205\344\272\272/Program.cs" @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConsoleApp3 +{ + class Program + { + static void Main(string[] args) + { + Surperman s = new Surperman("超人"); + s.Eat(); + s.Fly(); + s.Land(); + s.TakeOff(); + Console.WriteLine(""); + Bird b = new Bird("鸟"); + b.Eat(); + b.Fly(); + b.Land(); + b.TakeOff(); + b.LayEggs(); + Console.WriteLine(""); + Plane p = new Plane("飞机"); + p.CarryPassange(); + p.Fly(); + p.Land(); + p.TakeOff(); + } + } + interface IFlyable + { + void TakeOff(); + void Fly(); + void Land(); + } +} diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\351\243\236\346\234\272\350\266\205\344\272\272/Surperman.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\351\243\236\346\234\272\350\266\205\344\272\272/Surperman.cs" new file mode 100644 index 0000000..8bf19e7 --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\346\233\271\346\226\207\346\226\214/\351\243\236\346\234\272\350\266\205\344\272\272/Surperman.cs" @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConsoleApp3 +{ + class Surperman : Animal, IFlyable + { + public Surperman(string name) : base(name) + { + + } + public override void Eat() + { + Console.WriteLine("{0}会吃", this.Name); + } + public void Fly() + { + Console.WriteLine("{0}会飞", this.Name); + } + + public void Land() + { + Console.WriteLine("{0}会着陆", this.Name); + } + + public void TakeOff() + { + Console.WriteLine("{0}会起飞", this.Name); + } + } +} -- Gitee