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
What is default value of bool in c#?
Is class reference type c#?
What is a class level variable in c#?
Why is .net so popular?
Can structs in c# have destructors?
What is the difference between C# 3.5 and C# 4.0?
What is singleordefault?
Where do we use static class in c#?
What is a Managed Code??
What is a bool in c#?
What is lazy loading entity framework?
What is a partial class. Give an example?
What are the benefits of using the aggregate method in linq?
Is it possible to restrict the scope of a field/method of a class to the classes in the same namespace?
What is the difference between console and windows application?