第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定

正在回答

3 回答

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ces
{
??? class Program
??? {
??????? delegate void mmd(); //聲明一個賣萌大賽委托
??????? static void Main(string[] args)
??????? {
???????????? /*
??????????? Pet[] cry = new Pet[] { new Dog("小狗"), new Cat("小貓"), new Dog("小狗1") };
??????????? for (int x = 0; x < cry.Length; ++x)
??????????? {
??????????????? cry[x]++;
??????????????? cry[x].speak();
??????????????? cry[x].AVG();
??????????? }

??????????? Cat c = new Cat("Tom2");
??????????? c.speak();
??????????? c.fishing(); //輸出技能
??????????? c.tree();
??????????? Console.WriteLine();
??????????? Dog.NUM();

??????????? Dog d1 = new Dog("Tom");
??????????? d1.speak();
??????????? Cat c1 = d1;? //把小狗變小貓
??????????? c1.speak();
????????? /
?????????? var dogCage=new Cage<Dog>(1); //<放入寵物類型>
????????? dogCage.PutIn(new Dog("A")); //(new Dog("")調(diào)用寵物院里的寵物名字)
?????????? dogCage.PutIn(new Dog("B"));
??????????? var dog = dogCage.TakeOut(); //取出籠子里的狗,不取就沒法出現(xiàn)被隱藏了
?????????? dog.PrintName();? //取出的寵物名字是
???????????
??????????
??????????? var dog = new Dog("F");
??????????? dog.lsHappy<Person>(new Person()); //<聲明的人變量>后面是實列化new Person()相當(dāng)于Person person=new Person();
??????????? dog.lsHappy<int>(3); //當(dāng)狗看見3開心
???????????
??????????? Labrador dog = new Labrador("小狗A");
??????????? dog.Act(new SitDogCmd()); //實列輸出技能并用act引用
??????? //列表:List
?????????? List<Dog>? list = new List<Dog>();
??????????? list.Add(new Dog("C"));
??????????? for(int i=0;i<list.Count;++i){list[i].PrintName();}
??????????? //字典:Dictionary
??????????? Dictionary<string,Dog> dic = new Dictionary<string, Dog>();
??????????? dic.Add("A",new Dog("小狗2號")); //ADD添加 數(shù)量Count? 刪除Remove 訪問[Key]
??????????? dic["A"].PrintName();
???????????
????????????? //棧:Stack
??????????? Stack<Pet> stack = new Stack<Pet>(); //棧后面的<>指定類然后是實列化
??????????? stack.Push(new Dog("狗A"));
??????????? stack.Push(new Cat("貓A"));
??????????? stack.Peek().PrintName();

??????????? //隊列:??? Queue? //先進(jìn)先出類似2端開口 出隊Dequeue 入隊Enqueue
??????????? Queue<Pet> queue = new Queue<Pet>();
??????????? queue.Enqueue(new Dog("小狗B1"));
??????????? queue.Enqueue(new Dog("小狗B2"));
??????????? Pet pet = null;
??????????? pet = queue.Dequeue();
??????????? pet.PrintName();
??????????? pet = queue.Dequeue();
??????????? pet.PrintName();

??????????? mmd del = null;
??????????? Dog dog1 = new Dog("小狗賣萌");
??????????? Cat cat1 = new Dog("小狗賣萌");
??????????? del = dog1.MM;
??????????? del += cat1.MM;? //del+= 相當(dāng)于第一個加上第二個并且自動換行
??????????? del();? //輸出delegate委托
??????????? */
??????????? KF c1 = new KF();? //實列化一個客服
??????????? KF c2 = new KF();
??????????? Dog.XCW += c1.tz;? //把客服賦值給XCW委托事件,然后用委托事件判斷是否有新的寵物
??????????? Dog.XCW += c2.tz;? //因為要先聲明才能賦值判斷否者是空
??????????? Dog dog = new Dog("哈士奇");
???????????? Console.ReadLine();
??????? }
??? }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ces
{
???
??? interface skill? //本領(lǐng)
??? {
??????? void fishing();? //fishin捕魚
??? }
??? interface climb
??? {
??????? void tree();
??? }
??? public abstract class DogCmd
??????? {
???????? public abstract string GetCmd();//聲明GetCmd方法抽象方法abstract 不用函數(shù)體只能被繼承修改
???????? }? //定義技能
??? public class SitDogCmd:DogCmd
??? {
??????? public override string GetCmd()
??????? {
?????????? return "坐下"; //return還回? 還回一個坐下的參數(shù)給GetCmd()
??????? }
??? }? //什么技能
??? public interface lDogLearn<C>where C:DogCmd //限制c這個接口只能接受DogCmd相關(guān)的技能
??????? {
??????? void Act(C cmd);
???????? }? //聲明泛型接口來學(xué)技能
??? public abstract class Pet? //abstract抽象化使相當(dāng)于不存在
??? {
??????? public string NAME;? //在父類中聲明在派生類中base(繼承對象)
??????? public Pet(string name)
??????? {
??????????? NAME = name;
??????????? age = 0;
??????? }
??????? public abstract void speak();
??????? public int age;
??????? public static Pet operator ++(Pet pet)
??????? {
??????????? ++pet.age;
??????????? return pet;
??????? }
??????? public void AVG()
??????? {
??????????? Console.WriteLine("今年:" + age + "歲");
??????? }
??????? public void PrintName()
??????????? {
?????????????? Console.WriteLine("寵物的名字是"+NAME);
???????????? }
??????? public abstract void MM();
??? }
??? public class Dog : Pet
??? {
??????? public static int Nom; //聲名Nom為整數(shù)的靜態(tài)
??????? public static void NUM()
??????? {
??????????? Console.WriteLine("現(xiàn)在有幾條狗:" + Nom);? //用靜態(tài)輸出打印的狗
??????? }
??????? public Dog(string name) : base(name)
??????? {
??????????? ++Nom; //每賦值一個名字就加一條狗
??????????? if (XCW != null)? //判斷當(dāng)xcw不為空時還回給XCW新寵物
??????????? {
???????????????? XCW();
??????????? }
??????? }
??????? public override void speak()
??????? {

??????????? Console.WriteLine(NAME + "汪汪");
??????? }
??????? public void lsHappy<T>(T target)//where T:class //泛型方法? //約束只能用引用類型所以int會報錯
??????????? {
??????????????? Console.WriteLine("開心"+target.ToString()); //就是將該對象變成字符串,例如你傳進(jìn)來一個Cat類的對象cat,他就會將cat這個對象以字符串形式表現(xiàn)出來
??????????? }
???????? public override void MM()
??????? {
????????? Console.WriteLine("哈士奇萌萌大賽");
???????? }
??????? public delegate void XC(); //聲明事件
??????? public static event XC? XCW; //限制事件
??? }
??? public class Cat : Pet, skill, climb
??? {
??????? public void fishing()
??????? {
??????????? Console.Write("捕魚");
??????? }
??????? public void tree()
??????? {
??????????? Console.Write("爬樹");
??????? }
??????? public Cat(string name) : base(name)
??????? {
??????? }
??????? public override void speak()
??????? {

??????????? Console.WriteLine(NAME + "喵喵");
??????? }
??????????????? //用自定義方法可以轉(zhuǎn)換類型括號是要轉(zhuǎn)換對象,必須不加保護(hù)級別不抽象
????????? public static? implicit operator Cat(Dog dog)
??????????? {
????????????? return new Cat(dog.NAME);
???????????? }
???????????????? public override void MM()
??????? {
????????? Console.WriteLine("無辜看著你");
???????? }
??? }
??? class Person //定義一個人的類當(dāng)狗看見人開心
??????? {
??????? }
??? public class Labrador : Dog,lDogLearn<SitDogCmd>? //泛型<>接受上文聲明的技能
??? {
??????????? public Labrador(string name):base(name)
??????????? {
??????????? }
????????????? public void Act(SitDogCmd cmd) //實現(xiàn)一個泛型接口
????????????? {
??????????? Console.WriteLine(cmd.GetCmd()); //輸出技能
????????????? }
??? }
??? public class KF? //定義一個顧客類
??? {
??????? public void tz()
??????????? {
???????????? Console.WriteLine("有新的寵物來了");
???????????? }
???? }?????
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ces
{
??? public class Cage<T>
??? {
??????? T[] array;? //寵物
??????? int num;?? //聲明輸入寵物的數(shù)量
??????? readonly int Size;? //籠子數(shù)量

??????? public Cage(int n)
??????? {
??????????? Size = n; //賦值給籠子數(shù)量
??????????? num = 0;? //寵物初始為0
??????????? array = new T[Size]; //把籠子給寵物
??????? }
??????? public void PutIn(T pet)
??????? {
??????????? if (num < Size)
??????????? {
??????????????? array[num++] = pet;
??????????? }
??????????? else
??????????? {
??????????????? Console.WriteLine("籠子不夠,放不下");
??????????? }
??????? }
??????? public T TakeOut()? //取出寵物
??????? {
??????????? if (num > 0)
??????????? {
??????????????? return array[--num]; //取出一只就減一個
??????????? }
??????????? else
??????????? {
??????????????? Console.WriteLine("籠子是空的");
??????????????? return default(T);
??????????? }
??????? }
??? }
}

上把我看了在碼的泛型方法那簡直崩潰


2 回復(fù) 有任何疑惑可以回復(fù)我~
#1

Heron_Wang 提問者

非常感謝!??!
2018-08-08 回復(fù) 有任何疑惑可以回復(fù)我~

這些代碼難道不該是一起跟著打的嗎,光下載下來有什么用。。。

1 回復(fù) 有任何疑惑可以回復(fù)我~

老師是按他自己講的所以沒有下載地方不過上面的是我看完老師碼完了所有課程的(注解我有的理解錯誤)

0 回復(fù) 有任何疑惑可以回復(fù)我~

哪里下載?

1 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消

老師的整個課件的示例代碼在哪里下載啊

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號