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 yield c#?
What is double c#?
What is Implicit conversion in C#?
What is class and object c#?
what is IDisposal interface,IComparable,IEquatable,IFormatable
What is private and shared assembly?
Explain what are the steps for creating clr trigger?
How do you escape a character?
Why do we need escape characters?
What is string pool in c#?
Does c# do array bounds checking?
What is Global Assembly Cache (GAC) and what is the purpose of it? (How to make an assembly to public? Steps) How more than one version of an assembly can keep in same place?
Which types of inheritances does c# support?
What is difference between sleep () and wait ()?
Explain a MSIL ? Why is it appreciated by all developers?