示例#1
0
        static void Main(string[] args)
        {
            Camp rock = new Camp(243.2, 24.5, 56, 20, 10);
            Camp star = new Camp(226.2, 23.4, 53, 27, 15);

            if (rock > star)
            {
                Console.WriteLine("Camp Rock!");
            }
            else
            {
                Console.WriteLine("Camp Star!");
            }

            Camp rockStar = rock + star;

            Console.WriteLine(rock);
            Console.WriteLine();
            Console.WriteLine(star);
            Console.WriteLine();
            Console.WriteLine(rockStar);
        }
示例#2
0
        public static Camp operator +(Camp c1, Camp c2)
        {
            Camp biggerCamp = new Camp(c1.Latitude, c1.Longitude, c1.NumberOfPeople + c2.NumberOfPeople, c1.NumberOfTents + c2.NumberOfTents, c1.NumberOfFleshLights + c2.NumberOfFleshLights);

            return(biggerCamp);
        }
示例#3
0
        public override bool Equals(object o)
        {
            Camp other = o as Camp;

            return(this == other);
        }