What is hiding in CSharp ?
Answer / 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 |
Can you change the value of a variable while debugging a C# application?
Why multiple inheritance is not possible in c#
How do I declare inout arguments in c#?
Write one code example for compile time binding and one for run time binding? What is early/late binding?
What is the max value of int32 in c#?
What are the access-specifiers available in c#?
Explain manifest in c#.
What are the advantages of using partial classes?
Can I define a type that is an alias of another type (like typedef in c++)?
Explain what are three test cases you should go through in unit testing?
What?s the role of the DataReader class in ADO.NET connections?
What?s an abstract class?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)