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 difference between metadata and manifest?

569


How to achieve Polymorphism in VB.Net?

624


what is intermediate language?

612


Is it necessary to have SQL server installed in your computer in order to create a service based database in vb.net?

1870


Which is the base class for all the classes in .net framework?

568






What keyword is used to accept a variable number of parameter in a method?

577


What are different types of jit ?

595


Compare c# and visual basic.net?

558


What is a static variable?

567


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

550


Explain private assembly?

513


What is the difference between Namespace and Assembly?

583


Write a VB.Net console program to check whether a number is perfect or not.

6946


Explain the difference between thread and process?

515


What is visual basic.net culture?

508