J
Joe Duchtel
Hello -
I am defaulting an optional parameter to Single.NaN so I can determine
whether it was passed in or not. The problem is when I do this in an
overriden Sub/Function it will not compile. Here is the code ...
MustInherit Class cParent
Public MustOverride Sub XYZ(Optional ByVal aA As Single =
Single.NaN)
End Class
Class cChild
Inherits cParent
Public Overrides Sub XYZ(Optional ByVal aA As Single = Single.NaN)
' ...
End Sub
End Class
This causes a 'Public Overrides Sub XYZ([aA As Single = -1.#IND])'
cannot override 'Public MustOverride Sub XYZ([aA As Single = -1.#IND)'
because they differ by the default values of optional parameters.
Is this a glitch in Visual Studio or am I doing something wrong? I
tried it in both Visual Studio 2003 (.NET 1.1) and Visual Studio 2008
(.NET 2.0, 3.0, 3.5) ...
Thanks,
Joe
I am defaulting an optional parameter to Single.NaN so I can determine
whether it was passed in or not. The problem is when I do this in an
overriden Sub/Function it will not compile. Here is the code ...
MustInherit Class cParent
Public MustOverride Sub XYZ(Optional ByVal aA As Single =
Single.NaN)
End Class
Class cChild
Inherits cParent
Public Overrides Sub XYZ(Optional ByVal aA As Single = Single.NaN)
' ...
End Sub
End Class
This causes a 'Public Overrides Sub XYZ([aA As Single = -1.#IND])'
cannot override 'Public MustOverride Sub XYZ([aA As Single = -1.#IND)'
because they differ by the default values of optional parameters.
Is this a glitch in Visual Studio or am I doing something wrong? I
tried it in both Visual Studio 2003 (.NET 1.1) and Visual Studio 2008
(.NET 2.0, 3.0, 3.5) ...
Thanks,
Joe