From 0a9ffd7a55163eb95dc6c79f0fb0e11fde96dfa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=86=E7=93=9Ca?= <1991416367@qq.com> Date: Wed, 26 May 2021 12:13:47 +0800 Subject: [PATCH] zy --- .../Classfather.cs" | 118 +++++++++ .../Classson.cs" | 234 ++++++++++++++++++ .../Interfacesum.cs" | 49 ++++ .../Program.cs" | 110 ++++++++ 4 files changed, 511 insertions(+) create mode 100644 "\347\254\2543\346\254\241\344\275\234\344\270\232/\345\210\230\346\226\207\345\274\272/Classfather.cs" create mode 100644 "\347\254\2543\346\254\241\344\275\234\344\270\232/\345\210\230\346\226\207\345\274\272/Classson.cs" create mode 100644 "\347\254\2543\346\254\241\344\275\234\344\270\232/\345\210\230\346\226\207\345\274\272/Interfacesum.cs" create mode 100644 "\347\254\2543\346\254\241\344\275\234\344\270\232/\345\210\230\346\226\207\345\274\272/Program.cs" diff --git "a/\347\254\2543\346\254\241\344\275\234\344\270\232/\345\210\230\346\226\207\345\274\272/Classfather.cs" "b/\347\254\2543\346\254\241\344\275\234\344\270\232/\345\210\230\346\226\207\345\274\272/Classfather.cs" new file mode 100644 index 0000000..77ebb90 --- /dev/null +++ "b/\347\254\2543\346\254\241\344\275\234\344\270\232/\345\210\230\346\226\207\345\274\272/Classfather.cs" @@ -0,0 +1,118 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConsoleApp12 +{ + class Classfather + { + class Car + { + private string name; + public string Name { get; set; } + public Car(string name) + { + this.name = name; + } + + public void running() + { + Console.WriteLine("名字叫{0}的车在奔跑", this.name); + } + + class YDYPFATHER + { + + private string brand; + + public string Brand { get; set; } + + public YDYPFATHER(string brand) + { + this.Brand = brand; + + } + } + class Animal + { + private string name; + public string Name { get; set; } + public Animal(string name) + { + this.name = name; + } + public void eat() + { + Console.WriteLine("我的名字是{0}我能吃", this.name); + } + + } + class Animal1//动物 + { + private string name; + public string Name { get; set; } + + public Animal1(string name) + { + this.name = name; + } + public void hello() + { + Console.WriteLine("{0}是动物", this.name); + } + + } + class Vehicle//交通工具 + { + private string name; + public string Name { get; set; } + + public Vehicle(string name) + { + this.name = name; + } + + public void Hello() + { + Console.WriteLine("名字叫{0}的交通工具", this.name); + } + } + class Staff + { + private string name; + public string Name { get; set; } + public Staff(string name) + { + this.name = name; + } + public void hello() + { + Console.Write("我的名字是{0}", this.name); + } + } + class Teacher + { + private Iathletes iathletes; + + private string name; + public string Name { get; set; } + internal Iathletes Iathletes { get => iathletes; set => iathletes = value; } + + public Teacher(string name) + { + this.name = name; + } + public void hello() + { + Console.WriteLine("我的名字是{0}", this.name); + } + + } + + + } + + } +} diff --git "a/\347\254\2543\346\254\241\344\275\234\344\270\232/\345\210\230\346\226\207\345\274\272/Classson.cs" "b/\347\254\2543\346\254\241\344\275\234\344\270\232/\345\210\230\346\226\207\345\274\272/Classson.cs" new file mode 100644 index 0000000..2849120 --- /dev/null +++ "b/\347\254\2543\346\254\241\344\275\234\344\270\232/\345\210\230\346\226\207\345\274\272/Classson.cs" @@ -0,0 +1,234 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConsoleApp12 +{ + class Classson + { + class Batmobile : Car, Ifly + { + private string name; + public string Name { get; set; } + public Batmobile(string name) : base(name) + { + this.name = name; + } + + public void fly() + { + Console.WriteLine("名字叫{0}的蝙蝠战车在飞", this.name); + } + } + class BWMcar : Car + { + public BWMcar(string name) : base(name) + { + + } + } + class Up : YDYPFATHER, InterfaceUSB + { + private string name; + public string Name { get; set; } + public Up(string brand, string name) : base(brand) + { + this.name = name; + } + public void read() + { + Console.WriteLine("{0}的{1}在读取数据", base.Brand, this.name); + } + public void write() + { + Console.WriteLine("{0}的{1}在写入数据", base.Brand, this.name); + } + } + class Yp : YDYPFATHER, InterfaceUSB + { + private string name; + public string Name { get; set; } + public Yp(string brand, string name) : base(brand) + { + this.name = name; + } + + public void read() + { + Console.WriteLine("{0}的{1}在读取数据", this.Brand, this.name); + } + public void write() + { + Console.WriteLine("{0}的{1}在写入数据", this.Brand, this.name); + } + } + class computer + { + private string brand; + + private InterfaceUSB usb1; + private InterfaceUSB usb2; + + + + public computer(string brand) + { + this.brand = brand; + } + public string Brand { get; set; } + + public int MyProperty { get; set; } + internal InterfaceUSB Usb1 { get => usb1; set => usb1 = value; } + internal InterfaceUSB Usb2 { get => usb2; set => usb2 = value; } + + public void start() + { + Console.WriteLine("{0}的电脑开机", this.brand); + } + public void end() + { + Console.WriteLine("{0}的电脑关机", this.brand); + } + + public void readdate() + { + Usb1.read(); + Usb2.read(); + } + public void writedate() + { + Usb1.write(); + Usb2.write(); + } + + + } + class Cat : Animal, Iswmin, Iclimb + { + public Cat(string name) : base(name) + { + + } + public void climb() + { + Console.WriteLine("猫可以爬树没意见把,就是可能有的上去了就下不来了"); + } + + public void swmin() + { + Console.WriteLine("tom游泳"); + } + } + class Dog : Animal, Iswmin, Iclimb + { + public Dog(string name) : base(name) + { + + } + public void climb() + { + Console.WriteLine("狗都能爬树你敢相信?"); + } + + public void swmin() + { + Console.WriteLine("狗刨式"); + } + } + class Duck : Animal, Iswmin + { + public Duck(string name) : base(name) + { + + } + public void swmin() + { + Console.WriteLine("鸭子飘在水面上"); + } + } + class Monkey : Animal, Iclimb + { + public Monkey(string name) : base(name) + { + + } + public void climb() + { + Console.WriteLine("猴子爬树偷桃子"); + } + } + class Aircraft : Vehicle, IFLY//飞机 + { + private string name; + public Aircraft(string name) : base(name) + { + this.name = name; + } + + public void fly() + { + Console.WriteLine("{0}我能飞", this.name); + } + } + class Birds : Animal, IFLY, Ieat//鸟 + { + private string name; + public Birds(string name) : base(name) + { + this.name = name; + } + + public void eat() + { + Console.WriteLine("{0}我能吃", this.name); + } + + public void fly() + { + Console.WriteLine("{0}我能飞", this.name); + } + } + class Superman : Animal, IFLY, Ieat//超人 + { + private string name; + public Superman(string name) : base(name) + { + this.name = name; + } + public void fly() + { + Console.WriteLine("{0}我能飞", this.name); + } + public void eat() + { + Console.WriteLine("{0}我能吃", this.name); + } + } + class Musictea : Teacher, Iathletes + { + public Musictea(string name) : base(name) + { + + } + public void Athletes() + { + Console.WriteLine("我还是运动员"); + } + } + class Programmer : Staff, Iwriter + { + public Programmer(string name) : base(name) + { + + } + public void writer() + { + Console.Write("还是个作家"); + } + } + + } + +} diff --git "a/\347\254\2543\346\254\241\344\275\234\344\270\232/\345\210\230\346\226\207\345\274\272/Interfacesum.cs" "b/\347\254\2543\346\254\241\344\275\234\344\270\232/\345\210\230\346\226\207\345\274\272/Interfacesum.cs" new file mode 100644 index 0000000..62d1e8e --- /dev/null +++ "b/\347\254\2543\346\254\241\344\275\234\344\270\232/\345\210\230\346\226\207\345\274\272/Interfacesum.cs" @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConsoleApp12 +{ + interface Interfacesum + { + + } + interface Ifly + { + void fly(); + } + interface InterfaceUSB + { + void read(); + void write(); + } + interface Iclimb + { + void climb(); + } + interface Iswmin + { + void swmin(); + + } + + interface IFLY + { + void fly(); + } + interface Ieat + { + void eat(); + } + interface Iathletes + { + void Athletes(); + } + interface Iwriter + { + void writer(); + } + +} diff --git "a/\347\254\2543\346\254\241\344\275\234\344\270\232/\345\210\230\346\226\207\345\274\272/Program.cs" "b/\347\254\2543\346\254\241\344\275\234\344\270\232/\345\210\230\346\226\207\345\274\272/Program.cs" new file mode 100644 index 0000000..a1abfa9 --- /dev/null +++ "b/\347\254\2543\346\254\241\344\275\234\344\270\232/\345\210\230\346\226\207\345\274\272/Program.cs" @@ -0,0 +1,110 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConsoleApp12 +{ + class Program + { + static void Main(string[] args) + { + Batmobile batmobile = new Batmobile("眯着笑"); + batmobile.fly(); + batmobile.running(); + + Console.WriteLine("------"); + BWMcar bWMcar = new BWMcar("傻狗cx"); + bWMcar.running(); + + Yp yp = new Yp("金士顿", "Yp"); + yp.read(); + yp.write(); + + Up up = new Up("三星", "up"); + up.read(); + up.write(); + + Console.WriteLine(); + + computer computer = new computer("华硕"); + computer.start(); + computer.Usb1 = yp; + computer.Usb2 = up; + computer.readdate(); + computer.writedate(); + computer.end(); + + Console.ForegroundColor = ConsoleColor.Blue; + Cat cat = new Cat("阿猫"); + cat.eat(); + Climb(cat); + Console.WriteLine("-----------------"); + Console.ForegroundColor = ConsoleColor.Green; + Dog dog = new Dog("傻狗"); + dog.eat(); + Climb(dog); + Swmin(dog); + Console.WriteLine("-----------------"); + Console.ForegroundColor = ConsoleColor.White; + Duck duck = new Duck("唐老鸭"); + duck.eat(); + Swmin(duck); + Console.WriteLine("-----------------"); + Console.ForegroundColor = ConsoleColor.Red; + Monkey monkey = new Monkey("老六"); + monkey.eat(); + Climb(monkey); + Superman superman = new Superman("超人"); + //superman.eat(); + //superman.fly(); + superman.hello(); + Fly(superman); + Eat(superman); + Console.WriteLine("-----"); + Birds birds = new Birds("小鸟"); + birds.hello(); + Fly(birds); + Eat(birds); + //birds.fly(); + //birds.eat(); + Console.WriteLine("-----"); + Aircraft aircraft = new Aircraft("飞机"); + //aircraft.fly(); + aircraft.Hello(); + Fly(aircraft); + + Musictea musictea = new Musictea("英语老师"); + musictea.hello(); + musictea.Athletes(); + Console.WriteLine(); + Programmer programmer = new Programmer("程序员"); + programmer.hello(); + programmer.writer(); + Console.WriteLine(); + + } + public static void Fly(IFLY fLY) + { + fLY.fly(); + } + public static void Eat(Ieat ieat) + { + ieat.eat(); + } + + + static void Climb(Iclimb iclimb) + { + iclimb.climb(); + } + + static void Swmin(Iswmin iswmin) + { + iswmin.swmin(); + } + } +} + + -- Gitee