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 ?

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


Please Help Members By Posting Answers For Below Questions

What is the difference between ienumerable and iqueryable?

1032


How does yield return work c#?

978


To create a localized application which namespaces are necessary?

1024


What is msil, and why should developers need an appreciation of it if at all?

1096


What is gac? How to put assembly in gac?

1047


What is the difference between == and object.equals?

1065


What is the difference between ref and out parameters in c#?

1053


What is appdomain in c#?

961


Can enum be null c#?

1097


What is the difference while using directive vs using statement ?

1054


What are the 3 different types of arrays?

1073


Are value types sealed?

1040


Is c# and c sharp same?

900


Can firstordefault return null?

997


How long does it take to get a loop recorder put in?

895