Answer Posted / deep
Hiding is also called as Shadowing. This is the concept of Overriding the methods. It is a concept used in the Object Oriented Programming.
E.g.
public class ClassA {
public virtual void MethodA() {
Trace.WriteLine("ClassA Method");
}
}
public class ClassB : ClassA {
public new void MethodA() {
Trace.WriteLine("SubClass ClassB Method");
}
}
public class TopLevel {
static void Main(string[] args) {
TextWriter tw = Console.Out;
Trace.Listeners.Add(new TextWriterTraceListener(tw));
ClassA obj = new ClassB();
obj.MethodA(); // Outputs “Class A Method"
ClassB obj1 = new ClassB();
obj.MethodA(); // Outputs “SubClass ClassB Method”
}
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How do I automate my desktop application?
What is a reference type c#?
What is class method?
Explain polymorphism in c# with a simple example?
What is private constructor c#?
who is a protected class-level variable available to?
What is disconnected data architecture in c#?
How to do and Apply Themes to Datagrid,Lable,Textbox,etc., in C#.NET 2005 Windows Application? (like who we will do themes in ASP.NET using .CSS and .SKIN files). Urgent!!
What is platform independence"?
What is the difference between “finalize” and “finally” methods in c#?
Can you explicitly call a destructor?
How can you prevent escaping on backslashes in C# with string definitions?
Is there any sample c# code for simple threading?
What does console readkey do in c#?
what is the difference between a struct and a class in c#?