public override bool Equals(object obj)
        {
            if (!base.Equals(obj))
            {
                return(false);
            }

            CookedFood rhs = obj as CookedFood;

            return(this.CookingMethod == rhs.CookingMethod);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Food       apple        = new Food("apple", FoodGroup.Fruit);
            CookedFood strewdApple  = new CookedFood("Strewed", "apple", FoodGroup.Fruit);
            CookedFood bakedApple   = new CookedFood("Baked", "apple", FoodGroup.Fruit);
            CookedFood strewdApple2 = new CookedFood("Strewed", "apple", FoodGroup.Fruit);
            Food       apple2       = new Food("apple", FoodGroup.Fruit);


            DisplayWhetherEqual(apple, strewdApple);
            DisplayWhetherEqual(strewdApple, bakedApple);
            DisplayWhetherEqual(strewdApple, strewdApple2);
            DisplayWhetherEqual(apple, apple2);
            DisplayWhetherEqual(apple, apple);


            //Console.WriteLine(apple);
            //Console.WriteLine(strewdApple);
        }