Ejemplo n.º 1
0
        void Start()
        {
            //7. 请将第4题转化为c#代码。
            //======================================================实例化==================================================================

            Food sd = new Sardine();
            Wing greywing = new Wing();
            Seagull sg = new Seagull("seagull", 20, greywing, sd);

            Food shrimp = new Shrimp();
            Wing brownwing = new Wing();
            Petrel pt = new Petrel("petrel", 20, brownwing, shrimp);

            Food apple = new Apple();
            Wing hazelwing = new Wing();
            Ostrich os = new Ostrich("ostrich", 20, hazelwing, apple);


            //8. 请将第5题转化为c#代码。
            //======================================================实例化==================================================================
            Human Ningning = new Human("Ningning");
            Human Wuwu = new Human("wuwu");
            Human Zz = new Human("zz");

            FruitShop fruitShop = new FruitShop();
            ClothingShop clothingShop = new ClothingShop();

            Ningning.Shopping(fruitShop.Selling());
            Ningning.Giving(Ningning.goods, Wuwu);
            Wuwu.Eat(Wuwu.goods);

            Ningning.Shopping(clothingShop.Selling());
            Ningning.Giving(Ningning.goods, Zz);
            Zz.Wear();


            //9. 请将第6题转化为c#代码。
            //======================================================实例化==================================================================
            Director Baibai = new Director("baibai");
            List<Developer> friends = new List<Developer>
            {
                new Developer("writer"),
                new Developer("charactordesigner"),
                new Developer("setdesigner"),
                new Developer("animator"),
                new Developer("composer"),
                new Developer("sounddesigner"),
            };
            Audience dalao = new Audience();

            Baibai.CallingFriends(friends);
            Baibai.ShowToAudience(dalao);
            dalao.CommentFilm(Baibai.DirectFilm());
        }
Ejemplo n.º 2
0
 public Ostrich(string _ostrich, int _speed, Wing _wing, Food _food):base(_ostrich, _speed, _wing, _food)
 {
     Speed = _speed;
     wing = _wing;
     FavoriteFood = _food;
 }
Ejemplo n.º 3
0
 public Petrel(string _petrel, int _speed, Wing _wing, Food _food):base(_petrel, _speed, _wing, _food)
 {
     Speed = _speed;
     wing = _wing;
     FavoriteFood = _food;
 }
Ejemplo n.º 4
0
 public Seagull(string _seagull, int _speed, Wing _wing, Food _food):base(_seagull,_speed,_wing,_food)
 {
     Speed = _speed;
     wing = _wing;
     FavoriteFood = _food;
 }
Ejemplo n.º 5
0
 public Animal(string _specie, int _speed, Wing _wing, Food _food)
 {
     Speed = _speed;
     wing = _wing;
     FavoriteFood = _food;
 }