Hello. The course I am taking is discussing interfaces. What is the point of putting IEquatable<Ticket> next to the class name below? Because I took away the IEquatable<Ticket> just to see what would happen and the Equals method still worked the way it was supposed to so what exactly is the : IEquatable<Ticket> doing and what is the point of using it?
using System;
namespace Ticket
{
public class Ticket : IEquatable<Ticket>
{
// property to store the duration of the ticket in hours
public int DurationInHours { get; set; }
// simple constructor
public Ticket(int durationInHours)
{
DurationInHours = durationInHours;
}
public bool Equals(Ticket other)
{
return this.DurationInHours == other.DurationInHours;
}
}
}