What is shadowing?
Answers were Sorted based on User's Feedback
Answer / manikandan
When global and local varible in the same name.
the local varibale in a mehod or function which use to
override the global is called the shadowing.
ie the Global varible is being shadowed by the
local varible
Is This Answer Correct ? | 41 Yes | 8 No |
Answer / sonia.sardana
If 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.
Ex-
public class base
public sub test()
console.writeline("sonia")
end sub
public sub test(i as integer)
console.writeline(i)
end sub
end class
public sub derived
inherirts base
shadows sub test(x as integer)
console.writeline("Shadow method")
end sub
end class
sub main()
dim obj as new derived
obj.test()-->Invalid
obj.test(10)-->Valid
end sub
Is This Answer Correct ? | 22 Yes | 5 No |
Answer / rohit
Whatever the code written by Sonia.sardana is shows the
shadowing concept but there is some print mistakes in the
code.The correct code is---
imports system
module m1
public class base
Public Sub test()
Console.WriteLine("sonia")
End Sub
Public Sub test(ByVal i As Integer)
Console.WriteLine(i)
End Sub
End Class
Public class derived
inherits base
Shadows Sub test(ByVal x As Integer)
Console.WriteLine("Shadow method")
End Sub
end class
Sub main()
Dim obj As New derived
obj.test() 'This will show error
obj.test(10) 'This is valid
End Sub
end module
Is This Answer Correct ? | 8 Yes | 6 No |
Answer / 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 |
What is portable executable?
I Am Developing A project where I can send Message from One Computer to Another Computer With The Help Of LAN.Already I Have developed..It is working Fine With The Details Of ..TO,FROM,REF No,DATE,BODY...Now I Want To Add Attachments part in the same projects...How Can I Send Attachment File & How To Send It..I Am Working in VB.Net 2005 With out Any database. Can Any One Help me ??How To Write Code??Plz Send me a copy to my Mail also...I Dont Need Any Software Available in The Internet...Plz refer me The Code in VB.Net maloy.adhikari@in.com
Thank you for replying to my Question regarding Barcodes in VB.net. My next question is that how to use Barcode Fonts in VB.net I need a small code to Generate Barcodes in VB.net from a string of Values. This is the only problem i am left with in my project. Any body can help me please.
What do you mean by serialization?
List the types of authentication?
What are the objects in asp.net and tell the purpose of those objects
What is the DIfference between Friend and Protected Friend?
6 Answers CTS, Sykes Enterprises, TCS,
How a base class method is hidden?
in my windows application i have to show excelwork sheetwhich is stored in the local system can any one tell me the code?
Explain the difference between value and reference types?
code for export,import,save,update,delete ?
What is a static variable?