• +91 9723535972
  • info@interviewmaterial.com

CSharp Interview Questions and Answers

Question -   What is hiding in CSharp ?

Answer -   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”  } }

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners