static void Main(string[] args)
        {
            PetStore <Dog>  dogStore    = new PetStore <Dog>("Dog store");
            PetStore <Cat>  catStore    = new PetStore <Cat>("Cat store");
            PetStore <Fish> fishStore   = new PetStore <Fish>("Fish store");
            PetStore <Pet>  globalStore = new PetStore <Pet>("Global store");

            Dog  d1 = new Dog("Sparky", 5, true, "Meat");
            Dog  d2 = new Dog("Bak", 2, false, "Fruit");
            Cat  c1 = new Cat("Tom", 2, false, 3);
            Cat  c2 = new Cat("Garfield", 6, true, 8);
            Fish f1 = new Fish("Nemo", 1, "red", 10);
            Fish f2 = new Fish("Shark", 12, "grey", 50);

            dogStore.Pets.Add(d1);
            dogStore.Pets.Add(d2);
            catStore.Pets.Add(c1);
            catStore.Pets.Add(c2);
            fishStore.Pets.Add(f1);
            fishStore.Pets.Add(f2);

            globalStore.Pets.Add(d1);
            globalStore.Pets.Add(d2);
            globalStore.Pets.Add(c1);
            globalStore.Pets.Add(c2);
            globalStore.Pets.Add(f1);
            globalStore.Pets.Add(f2);

            Console.WriteLine(dogStore.GetPets());
            Console.WriteLine(catStore.GetPets());
            Console.WriteLine(fishStore.GetPets());
            Console.WriteLine(globalStore.GetPets());

            Console.WriteLine(dogStore.BuyPet("Bak"));
            Console.WriteLine(catStore.BuyPet("Test"));
            Console.WriteLine(globalStore.BuyPet("Tom"));

            Console.WriteLine(dogStore.GetPets());
            Console.WriteLine(catStore.GetPets());
            Console.WriteLine(fishStore.GetPets());
            Console.WriteLine(globalStore.GetPets());
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            PetStore <Dog>  DogStore  = new PetStore <Dog>();
            PetStore <Cat>  CatStore  = new PetStore <Cat>();
            PetStore <Fish> FishStore = new PetStore <Fish>();

            DogStore.AddPetsToStore(new Dog()
            {
                Name    = "Sharko", Age = 5, FavouriteFood = "meat",
                GoodBoi = true, Type = "Labrador"
            });
            DogStore.AddPetsToStore(new Dog()
            {
                Name = "Blacky", Age = 2, FavouriteFood = "PedegreePall", GoodBoi = true, Type = "Hasky"
            });


            CatStore.AddPetsToStore(new Cat()
            {
                Name = "Flufy", Age = 1, Lazy = true, LivesLeft = 5, Type = "Persian"
            });
            CatStore.AddPetsToStore(new Cat()
            {
                Name = "Tom", Age = 70, Lazy = false, LivesLeft = 1, Type = "CartoonCat"
            });

            FishStore.AddPetsToStore(new Fish("Grey", 3.5, "Cleo", "Throut", 9));
            FishStore.AddPetsToStore(new Fish("Yellow and White", 0.5, "Nemo", "seafish", 1));

            DogStore.BuyPet("Sharko");
            CatStore.BuyPet("Meow");
            Console.WriteLine("---------------------");
            DogStore.PrintPets();
            CatStore.PrintPets();
            FishStore.PrintPets();



            Console.ReadLine();
        }