Esempio n. 1
0
        public static void Main(string[] args)
        {
            SimpleDate d = new SimpleDate(1, 2, 2000);

            Console.WriteLine(d.Equals("heh"));
            Console.WriteLine(d.Equals(new SimpleDate(5, 2, 2012)));
            Console.WriteLine(d.Equals(new SimpleDate(1, 2, 2000)));
        }
Esempio n. 2
0
 public bool Earlier(SimpleDate compared)
 {
     if (this.year < compared.year)
     {
         return(true);
     }
     if (this.year == compared.year && this.month < compared.month)
     {
         return(true);
     }
     if (this.year == compared.year && this.month == compared.month &&
         this.day < compared.day)
     {
         return(true);
     }
     return(false);
 }
Esempio n. 3
0
        public override bool Equals(object compared)
        {
            // DO SOMETHING HERE
            if ((compared == null) || !this.GetType().Equals(compared.GetType()))
            {
                return(false);
            }

            SimpleDate daa = (SimpleDate)compared;

            //if(this.day == daa.day && this.month == daa.month && this.year == daa.year)

            if (day.Equals(daa.day) && month.Equals(daa.month) && year.Equals(daa.year))
            {
                return(true);
            }
            return(false);
        }
Esempio n. 4
0
        public override bool Equals(object compared)
        {
            // DO SOMETHING HERE
            if (this == compared)
            {
                return(true);
            }
            if ((compared == null) || !this.GetType().Equals(compared.GetType()))

            {
                return(false);
            }
            // Converts the object to an object specific to this class.
            SimpleDate comparedSimpleData = (SimpleDate)compared;

            // If the values of the object variables are the same, the objects are equal
            return(this.day == comparedSimpleData.day &&
                   this.month == comparedSimpleData.month &&
                   this.year == comparedSimpleData.year);
        }
Esempio n. 5
0
        public override bool Equals(object compared)
        {
            // DO SOMETHING HERE
            if (this == compared) //Compares the locations of the objects. If they are the same, they are equal.
            {
                return(true);
            }

            // If the compared object is null, or not of the correct type, then they are not equal.
            if ((compared == null) || !this.GetType().Equals(compared.GetType()))
            {
                return(false);
            }

            // Converts the object to an object specific to this class.
            SimpleDate comparedDate = (SimpleDate)compared;

            // If the values of the object variables are the same, the objects are equal
            return(this.day == comparedDate.day &&
                   this.month == comparedDate.month &&
                   this.year == comparedDate.year);
        }
        public override bool Equals(object compared)
        {
            // DO SOMETHING HERE
            if (this == compared)
            {
                return(true);
            }


            if ((compared == null) || !this.GetType().Equals(compared.GetType()))
            {
                return(false);
            }


            SimpleDate comparedDate = (SimpleDate)compared;


            return(this.day == comparedDate.day &&
                   this.month == comparedDate.month &&
                   this.year == comparedDate.year);
        }
        public override bool Equals(object compared)
        {
            // DO SOMETHING HERE
            // if the variables are located in the same position, they are equal
            if (this == compared)
            {
                return(true);
            }

            // if the compared object is null or not of type, the objects are not equal
            if ((compared == null) || !this.GetType().Equals(compared.GetType()))
            {
                return(false);
            }
            else
            {
                // convert the object to a this class
                SimpleDate comparedDate = (SimpleDate)compared;

                // if the values of the object variables are equal, the objects are, too
                return(this.day == comparedDate.day && this.month == comparedDate.month && this.year == comparedDate.year);
            }
        }
Esempio n. 8
0
        public override bool Equals(object compared)
        {
            // SimpleDate sd = new SimpleDate();
            if ((compared == null) || !this.GetType().Equals(compared.GetType()))
            {
                return(false);
            }

            SimpleDate sd = (SimpleDate)compared;

            if (this.year != sd.year)
            {
                return(false);
            }
            if (this.month != sd.month)
            {
                return(false);
            }
            if (this.day != sd.day)
            {
                return(false);
            }
            return(true);
        }