diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/.keep" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/.keep" new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo01/Computer.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo01/Computer.cs" new file mode 100644 index 0000000000000000000000000000000000000000..fda700e9a3f38f9d40e346fb326ee707686e6c00 --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo01/Computer.cs" @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Demo01 +{ + class Computer + { + private string brand; + + public Computer(string brand) + { + this.brand = brand; + } + + private IUSB usb1; + private IUSB usb2; + + public string Brand { get => brand; set => brand = value; } + internal IUSB Usb1 { get => usb1; set => usb1 = value; } + internal IUSB Usb2 { get => usb2; set => usb2 = value; } + public void Start() + { + Console.WriteLine("{0}开机中...",this.brand); + } + + public void ReadData() + { + this.usb1.Read(); + this.usb2.Read(); + } + + public void WriteData() + { + this.usb1.Write(); + this.usb2.Write(); + } + public void End() + { + Console.WriteLine("{0}关机中...",this.brand); + } + } + +} diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo01/Disk.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo01/Disk.cs" new file mode 100644 index 0000000000000000000000000000000000000000..40bab812ac6bf351472a66a7187272ec63d6450d --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo01/Disk.cs" @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Demo01 +{ + class Disk + { + private string brand; + + public Disk(string brand) + { + this.brand = brand; + } + public Disk() { } + + public string Brand { get => brand; set => brand = value; } + public void Info() + { + Console.WriteLine("{0}品牌的硬盘", this.brand); + + } + + } + +} diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo01/IUSB.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo01/IUSB.cs" new file mode 100644 index 0000000000000000000000000000000000000000..99493bd33306d37d22017f23230ad34f9bf6f9b8 --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo01/IUSB.cs" @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Demo01 +{ + interface IUSB + { + void Read(); + + + void Write(); + } +} diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo01/MobileHardDisk.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo01/MobileHardDisk.cs" new file mode 100644 index 0000000000000000000000000000000000000000..c72494941397139b1bca383f58cba55aecc5be04 --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo01/MobileHardDisk.cs" @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Demo01 +{ + class MobileHardDisk:Disk,IUSB + { + public MobileHardDisk(string brand) : base(brand) + { + + } + + 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/\347\273\203\346\226\207\346\265\251/Demo01/Program.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo01/Program.cs" new file mode 100644 index 0000000000000000000000000000000000000000..3210d48cb2fb08c6973bb82424794e25a8d7f3eb --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo01/Program.cs" @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Demo01 +{ + class Program + { + static void Main(string[] args) + { + Udisk ud = new Udisk("金士顿64G"); + MobileHardDisk mhd = new MobileHardDisk("三星64G"); + + ud.Info(); + ud.Read(); + ud.Write(); + Console.WriteLine(); + mhd.Info(); + mhd.Read(); + mhd.Write(); + + Console.WriteLine(); + Computer com = new Computer("联想"); + com.Start(); + com.Usb1 = ud; + com.Usb2 = mhd; + com.WriteData(); + com.ReadData(); + + com.End(); + + + } + } +} diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo01/Udisk.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo01/Udisk.cs" new file mode 100644 index 0000000000000000000000000000000000000000..6bb5b0bd801d4ca147952e52a8c739168bf80901 --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo01/Udisk.cs" @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Demo01 +{ + class Udisk:Disk,IUSB + { + public Udisk(string brand) : base(brand) + { + + } + 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/\347\273\203\346\226\207\346\265\251/Demo02/Batcar.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo02/Batcar.cs" new file mode 100644 index 0000000000000000000000000000000000000000..80cdb31be02af8e84e493d21b1f771315bdeb8df --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo02/Batcar.cs" @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Demo02 +{ + class Batcar : Car, IFIyable + { + public Batcar(string brand) : base(brand) + { } + public void fly() + { + Console.WriteLine("{0]车在飞",this.Brand); + + } + public override void Run() + { + Console.WriteLine("{0}车在跑",this.Brand); + } + + + } +} diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo02/Car.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo02/Car.cs" new file mode 100644 index 0000000000000000000000000000000000000000..b75b65ebb26c35ff778596baee7028dcc7ed3abc --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo02/Car.cs" @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Demo02 +{ + abstract class Car + { + private string brand; + + public string Brand { get; set; } + + public Car(string brand) { + Brand = brand; + } + public abstract void Run(); + } +} diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo02/IFIyable.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo02/IFIyable.cs" new file mode 100644 index 0000000000000000000000000000000000000000..19c0fc87ac72e03cc3ea0581fea34250999c1f38 --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo02/IFIyable.cs" @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Demo02 +{ + interface IFIyable + { + } +} diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo02/Onecar.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo02/Onecar.cs" new file mode 100644 index 0000000000000000000000000000000000000000..1f43be8cdd4b8511633e72705c3b93aca9eb8de8 --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo02/Onecar.cs" @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Demo02 +{ + class Onecar:Car + { + public Onecar (string brand):base(brand) + { + + } + public override void Run() + { + Console.WriteLine("{0}车在跑",this.Brand); + } + + } +} diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo02/Program.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo02/Program.cs" new file mode 100644 index 0000000000000000000000000000000000000000..13d98c4f11a29d80443bd2ca6f7e4cea7fdf12fa --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo02/Program.cs" @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Demo02 +{ + class Program + { + static void Main(string[] args) + { + Onecar oc = new Onecar("一台"); + oc.Run(); + Batcar bat = new Batcar("一台蝙蝠"); + bat.Run(); + bat.fly(); + } + } +} diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo03/Animal.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo03/Animal.cs" new file mode 100644 index 0000000000000000000000000000000000000000..e52f12013bdf89ac57dd404783b24c05e2df5571 --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo03/Animal.cs" @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Demo03 +{ + abstract class Animal + { + public abstract void eat(); + } +} diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo03/Cat.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo03/Cat.cs" new file mode 100644 index 0000000000000000000000000000000000000000..ce70b938c78396a60c72ee9f28f0a8921792cae3 --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo03/Cat.cs" @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Demo03 +{ + class Cat:Animal,ITree + { + public void Tree() + { + Console.WriteLine("猫在爬树"); + + } + + public override void eat() + { + Console.WriteLine("猫在吃饭"); + } + + } +} diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo03/Dog.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo03/Dog.cs" new file mode 100644 index 0000000000000000000000000000000000000000..f1e21b14e5452d8314a7b4699dc1307c98c43817 --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo03/Dog.cs" @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Demo03 +{ + class Dog:Animal,ISwim + { + public void swim() + { + Console.WriteLine("狗在游泳"); + } + public override void eat() + { + Console.WriteLine("狗在吃饭"); + } + + } +} diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo03/Duck.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo03/Duck.cs" new file mode 100644 index 0000000000000000000000000000000000000000..ada2062b1cdfbb936dc3299152f04deeb144d2c5 --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo03/Duck.cs" @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Demo03 +{ + class Duck:Animal,ISwim + { + public void swim() + { + Console.WriteLine("鸭子在游泳"); + } + public override void eat() + { + Console.WriteLine("鸭子在吃饭"); + } + + } +} diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo03/ISwim.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo03/ISwim.cs" new file mode 100644 index 0000000000000000000000000000000000000000..f6f289d7682384750b88aaa7e321c49f5b1de46f --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo03/ISwim.cs" @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Demo03 +{ + interface ISwim + { + void swim(); + + + } +} diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo03/ITree.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo03/ITree.cs" new file mode 100644 index 0000000000000000000000000000000000000000..dba94012710cc9e0d469b3b7f636bab720fa7f53 --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo03/ITree.cs" @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Demo03 +{ + interface ITree + { + + void Tree(); + } +} diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo03/Monkey.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo03/Monkey.cs" new file mode 100644 index 0000000000000000000000000000000000000000..226d659e009248d68a852f4ff27935be46548fba --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo03/Monkey.cs" @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Demo03 +{ + class Monkey:Animal,ITree + { + + public void Tree() + { + Console.WriteLine("猴子在爬树"); + } + + public override void eat() + { + Console.WriteLine("猴子在吃饭"); + } + } +} diff --git "a/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo03/Program.cs" "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo03/Program.cs" new file mode 100644 index 0000000000000000000000000000000000000000..3b22c251ef2673624e38671bf8a035d8367751f0 --- /dev/null +++ "b/\347\254\2542\346\254\241\344\275\234\344\270\232/\347\273\203\346\226\207\346\265\251/Demo03/Program.cs" @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Demo03 +{ + class Program + { + static void Main(string[] args) + { + ITree tr = new Cat(); + Tree(tr); + + ISwim sw = new Duck(); + Swim(sw); + + Animal am = new Dog(); + eat(am); + } + + + static void Tree(ITree tr) { + tr.Tree(); + } + static void Swim(ISwim sw) + { + sw.swim(); + } + static void eat(Animal am) + { + am.eat(); + } + + } +}