I tried overloading in VBA in a class module:
Dim a As Integer
Public Property Let SomeNumber(newNumber as Integer)
a = newNumber
End Property
Public Property Let SomeNumber(newNumber as String)
a = Val(newNumber)
End Property
Public Property Get SomeNumber() As Integer
SomeNumber = a
End Property
The compiler complains that an "ambiguous name" was found where, obviously, another signature exists. Is it possible to overload a property defined in a class in VBA or VB6? If so, what will be the syntax?
In addition, if property overloading is not possible, what advantages do properties offer with get / set methods defined by public functions other than a simpler way to access the fields of the created object?
source
share