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 the difference between ienumerable and iqueryable?
How does yield return work c#?
To create a localized application which namespaces are necessary?
What is msil, and why should developers need an appreciation of it if at all?
What is gac? How to put assembly in gac?
What is the difference between == and object.equals?
What is the difference between ref and out parameters in c#?
What is appdomain in c#?
Can enum be null c#?
What is the difference while using directive vs using statement ?
What are the 3 different types of arrays?
Are value types sealed?
Is c# and c sharp same?
Can firstordefault return null?
How long does it take to get a loop recorder put in?