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 many constructors can a class have c#?
What is indexer c#?
What does static mean in c sharp?
What does protected internal access modifier mean?
What is data quality assurance?
What is difference between var dynamic and object in c#?
Explain the Usage of web.config
What are the 4 pillars of any object oriented programming language?
Explain the difference between a Private Assembly and a Shared Assembly
What is the CTS, and how does it relate to the CLS?
In which order the destructor is called for an inherited class?
What is difference between a constant and read-only in C#?
What is type cast in C#?
Which one is trusted and which one is untrusted?
What is the difference between list and ilist in c#?