I have a class:
class Stock : Product
{
}
And in that class i have made a Equals method:
public bool Equals(Product p)
{
return (p.Id == this.Id);
}
But it’s not working. It tells me that Equals:
Warning 1 ‘WindowsFormsApplication1.Stock.Equals(WindowsFormsApplication1.Product)’ hides inherited member ‘WindowsFormsApplication1.Product.Equals(WindowsFormsApplication1.Product)’. Use the new keyword if hiding was intended.
C:\Users\tom\Desktop\uni\WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\Stock.cs 36 21 WindowsFormsApplication1
Anyone know why this is?
You need to override
Equalsmethod, which is already used in Product Class.Or use
newkeyword. But I don’t think ‘new’ is what you want.