ObjectBase |
This class is not intended to be used by code other than in the methods of the IObject interface implementations.
Name | Description |
---|---|
Equals | Default object comparison. Simply checks for reference to same instance. |
GetHashCode | Returns a hashcode for the specified object instance. |
ToString | Returns a string representation of the object instance with optional project name. |
The implementer of the IObject interface can use this method as the default behavior, or create custom behavior using their own logic.
This example shows the typical implementation of the IObject interface using the MyBase methods for default behavior.
Option Explicit Implements IObject Public Function Equals(ByRef Value As Variant) As Boolean Equals = MyBase.Equals(Me, Value) End Function Public Function GetHashCode() As Long GetHashCode = MyBase.GetHashCode(Me) End Function Public Function ToString() As String ToString = MyBase.ToString(Me, App) End Function ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' IObject ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Function IObject_Equals(Value As Variant) As Boolean IObject_Equals = Equals(Value) End Function Private Function IObject_GetHashCode() As Long IObject_GetHashCode = GetHashCode End Function Private Function IObject_ToString() As String IObject_ToString = ToString End Function