I have the following class based on example code from Microsoft MSDN:
Imports System.Collections.Generic
Module SharedCode
Public Class Fund
Implements IEquatable(Of Fund)
'Class Fund must implement Function Equals(other As RetirementCalcOverTime.SharedCode.Fund) As Boolean for interface System.IEquatable(Of Fund)
Public Property FundName As String
Public Property StartDate As Date
Public Property StartBalance As Double
Public Property StartQuantity As Double
Public Property StartPrice As String
Public Sub New()
End Sub
Public Sub New(ByVal sFundName As String,
ByVal dStartDate As Date,
ByVal pStartBalance As Double,
ByVal pStartQuantity As Double,
ByVal pStartPrice As Double)
FundName = sFundName
StartDate = dStartDate
StartBalance = pStartBalance
StartQuantity = pStartQuantity
StartPrice = pStartPrice
End Sub
Public Function Overrides Equals(ByVal obj As Fund) As Boolean
'Overrides is flagged as invalid identifier
If obj Is Nothing Then
Return False
End If
Dim objAsFund As Fund = TryCast(obj, Fund)
If objAsFund Is Nothing Then
Return False
Else
Return Equals(objAsFund)
End If
End Function
End Class
End Module
What am I doing wrong that overrides and the Equals function throw errors?