Operator
overloading example:
(where USD is a class for representing the United States Dollar
currency)
' 1st overload Adds 2 USD value amounts
together and returns a USD amount.
Public Shared Operator +(ByVal h1 As USD, ByVal h2 As USD) As USD
Return New USD(h1.value + h2.value)
End Operator
' 2nd overload Adds a USD value and a double value
together and returns a USD amount.
Public Shared Operator +(ByVal h1 As USD, ByVal d As Double) As USD
Return New USD(h1.value + d)
End Operator
|
|