Hi Fabio,
Overloading a method allows you to specify multiple versions of the same
method, but with a different parameter signature:
Public Overloads Sub ShowMessge(ByVal Text As String)
'
End Sub
Public Overloads Sub ShowMessage(ByVal Number As Integer)
'
End Sub
Public Overloads Function ShowMessage(ByVal Number As Integer, ByVal Text As
String) As Boolean
'
End Sub
You can overload the return type of a method, as long as the parameters are
different to any other overloaded version.
Shadowing isn't *really* related to Overloading (perhaps you meant
overriding?), however it is linked due to the fact that you can overload a
version of a method in a base class, with a new version in the derived class
Public Class MyBaseClass
Public Sub MySub()
'
End Sub
End Class
Public Class MyDerivedClass
Inherits MyBaseClass
Public Shadows Function MySub(Argument As String) As Integer
'
End Sub
End Class
* or *
Public Class MyBaseClass
Public Sub MySub()
'
End Sub
End Class
Public Class MyDerivedClass
Inherits MyBaseClass
Public Overloads Function MySub(Argument As String) As Integer
'
End Sub
End Class
They are both valid because the parameters are different.
The shadows clause, when attached to a method declaration allows you to
replace a method that's declared in a base class, with a new version, in the
new class. It does not override the base method, and so you can specify a
different access level, or return type, or parameters. This means you can
create a new version of a method that replaces a method in the base class
that is not declared as overridable.
--
HTH,
-- Tom Spink, Über Geek
Please respond to the newsgroup,
so all can benefit
" System.Reflection Master "
==== Converting to 2002 ====
Remove inline declarations