What is shadowing?

Answer Posted / rohatash

there are overloaded methods in the base class, & u
marks one of the methods as shadows using the keyword
shadow in the derived class, then we cannot access the
overloaded methods.
Module Module1

Class A
Public Sub Show()
Console.WriteLine("Calling from A")
End Sub
End Class

Class B
Inherits A
Public Shadows Sub Show()
Console.WriteLine("Calling from B")
End Sub
End Class

Class C
Inherits B
Public Shadows Sub Show()
Console.WriteLine("Calling from C")
End Sub
End Class

Class Test
Public Shared Sub Main()
Dim x As A
x = New A()
x.Show()
x = New B()
x.Show()
x = New C()
x.Show()
End Sub
End Class

End Module

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the strong name in .net assembly?

644


What is the difference between custom control and user control?

632


What is the purpose of an Assembly?

704


What is difference between import system.data.sqlclient,system.data.oledb?

633


How many languages are supported by .net?

625






What is misl code?

649


Tell me how many .net languages can a single .net dll contain?

602


Name and explain some of the exclusive features which are present in vb?

625


What is the differnce between managed code and unmanaged code?

622


What are jagged arrarys ?

650


Explain manifest?

575


Explain the components of common language runtime.

613


What is static member?

652


How to run a dos command in vb.net?

685


What is the significance of delegates. Where should they be used?

578