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 User controls and Custom Controls?
Is c sharp open source?
What does immutable mean in c#?
what is difference between destruct or and garbage collection ?
What is type checking in c#?
What are the benefits of using windows services:
Explain the types of Polymorphism.
what are some characteristics of an array?
Difference between a sub and a function in c#.
In .NET which is the smallest unit of execution?
Why do we use ienumerable in c#?
What is a cs file?
Explain the importance and use of each, version, culture and publickeytoken for an assembly.
Why constructor is used in c#?
Define Final Class in C#