Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What is hiding in CSharp ?



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

Post New Answer

More C Sharp Interview Questions

Are private class-level variables inherited?

5 Answers  


Constructor to an arbitrary base constructor?

0 Answers  


What?s the implicit name of the parameter that gets passed into the class? set method?

1 Answers  


What are data types examples?

0 Answers  


Why do we use constructors in c#?

0 Answers  


If I want to override a method 1 of class A and in class b then how do you declare ?

4 Answers   MMTS,


Does c# have its own class library?

0 Answers  


What is the difference between func and action delegate?

0 Answers  


What is local function?

0 Answers  


How to sign an assembly with strong name?

0 Answers   CitiusTech,


What does the keyword virtual mean in the method definition?

3 Answers   Ipog Software, Satyam, Visual Soft,


What is parsing? How to parse a date time string?

0 Answers  


Categories