예제 #1
0
        static void Main(string[] args)
        {
            // creating an instance(OBJECT) of each animal class
            Ants      ant   = new Ants();
            BettaFish betta = new BettaFish {
                MaximumDepth = 50
            };
            CopperheadSnakes coppersnake = new CopperheadSnakes();
            Earthworms       earthworm   = new Earthworms();
            Finches          finch       = new Finches();
            Gerbils          gerbil      = new Gerbils();
            Mice             mice        = new Mice();
            Parakeets        parakeet    = new Parakeets();
            Terrapins        terrapin    = new Terrapins {
                MaximumDepth = 50
            };

            TimberRattlesnakes timbersnake = new TimberRattlesnakes();

            // add the animals to thier corresponding container
            Diggers diggersContainer = new Diggers();

            diggersContainer.diggers.Add(ant);
            diggersContainer.diggers.Add(earthworm);

            Swimmers swimmersContainer = new Swimmers();

            swimmersContainer.swimmers.Add(betta);
            swimmersContainer.swimmers.Add(terrapin);

            Fliers fliersContainer = new Fliers();

            fliersContainer.fliers.Add(parakeet);
            fliersContainer.fliers.Add(finch);

            AboveGround aboveGroundContainer = new AboveGround();

            aboveGroundContainer.grounders.Add(coppersnake);
            aboveGroundContainer.grounders.Add(gerbil);
            aboveGroundContainer.grounders.Add(mice);
            aboveGroundContainer.grounders.Add(timbersnake);
        }
예제 #2
0
 static void Main(string[] args)
 {
     Parakeets myParakeet = new Parakeets()
     {
         Species = "Budgerigar",
         Name    = "Sqawkey",
         Color   = "lime green",
         Food    = "Fruit and Nuts",
         Flier   = true
     };
     Earthworms myEarthworm = new Earthworms()
     {
         Species = "Common Earthworm",
         Name    = "Wormy",
         Color   = "tan",
         Food    = "Dirt",
         Digger  = true
     };
     Terrapins myTerrapin = new Terrapins()
     {
         Species = "Southern River Terrapin",
         Name    = "Steve",
         Color   = "Black",
         Food    = "Algae",
         Swimmer = true,
         Crawler = true
     };
     Rattlesnake myRattlesnake = new Rattlesnake()
     {
         Species = "Diamondback Rattlesnake",
         Name    = "Bitey",
         Color   = "Brown",
         Food    = "Mice",
         Crawler = true
     };
     Mice myMouse = new Mice()
     {
         Species = "Deer Mouse",
         Name    = "Mr. Wiggles",
         Color   = "Tan",
         Food    = "Seed and Nuts",
         Digger  = true,
         Crawler = true
     };
     Ants myAnt = new Ants()
     {
         Species = "Black Garden Ant",
         Name    = "Sgt. Stiggs",
         Color   = "Black",
         Food    = "Crumbs",
         Crawler = true,
         Digger  = true
     };
     Finches myFinch = new Finches()
     {
         Species = "Common Cactus Finch",
         Name    = "Gertrude",
         Color   = "Black",
         Food    = "Worms",
         Flier   = true
     };
     BetaFish myBetaFish = new BetaFish()
     {
         Species = "Combtail Betta",
         Name    = "Willis",
         Color   = "Blue and Purple",
         Food    = "Fish Flakes",
         Swimmer = true
     };
     Copperhead myCopperhead = new Copperhead()
     {
         Species = "Australian Copperhead",
         Name    = "Greg",
         Color   = "Grey and Brown",
         Food    = "Mice",
         Crawler = true,
         Swimmer = true
     };
     Gerbils myGerbil = new Gerbils()
     {
         Species = "Fat-Tailed Gerbil",
         Name    = "Tan",
         Color   = "Bill",
         Food    = "Seeds and Nuts",
         Digger  = true,
         Crawler = true
     };
 }