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 parameters can a method have c#?
What are the types of class in c#?
How is a string immutable?
What is difference between mutable and immutable in c#?
What is a static class in c#?
How is lazy loading achieved?
What are the return types in c#?
Which language is used for desktop application?
Explain the difference between “constant” and “read-only” variables used in c#?
Can you call from an inherited constructor to a specific base constructor if both base class and an inheriting class has a number of overloaded constructors?
1. Describe page life cycle?
Explain data types in c#?
What are the Types of compatabilities and explain them
how to prevent a class from being inherited in c#.net?
What is .net console?