ARTICLE
Shadowing in VB.NET
In this article i will describe Data shadowing in VB.NET
Download
Files:
Shadowing :- This is a VB.Net Concept by
which you can provide a new implementation for the base class member without
overriding the member. You can shadow a base class member in the derived class
by using the keyword Shadows.The method signature access level and return type
of the shadowed member can be completely different than the base class member.
Note:-overriding is used to redefines
only the methods. but shadowing redefines the entire element.
Coding
Class
Shadow
Shared x As Integer = 1
Shared Sub
Main()
Dim x As Integer = 10
'--- prints local, not class variable.
Console.WriteLine("main: x" & x)
'--- prints class, not local variable.
Console.WriteLine("main sahdow x:" & Shadow.x)
End Sub
End Class
Output:
