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's the difference between abstraction and encapsulation?
In which order the constructor is called for an inherited class?
What are PE(Portable Executable)?
What is difference between ienumerable and list?
What is the difference between static and private constructor in c#?
If a class derives from another class, will the derived class automatically contain all the public, protected, and internal members of the base class?
What is assembly version series sequence?
What is the main purpose of xml?
Does a class need a constructor c#?
Can we create extension method for interface?
What do you mean by jagged array?
What is use of FormBoarderStyle Propertie
How do destructors and garbage collection work in c#?
what are the different ways a method can be overloaded?
What is anonymous methods in c#?