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

What is the use of 'using' statement in c#?

0 Answers  


What is the meaning of extention?

0 Answers  


What is extended method in c#

3 Answers   iNautix,


What is difference between assembly and dll?

0 Answers  


How to transpose rows into columns and columns into rows in a multi-dimensional array?

4 Answers   Microsoft,


What is windows forms in c#?

0 Answers  


What is generic delegate in c#?

0 Answers  


What are the fundamental principles of oo programming?

0 Answers  


Can you prevent a class from overriding?

3 Answers  


How many root nodes are there in an xml document?

0 Answers  


What is func c#?

0 Answers  


What are mutable and immutable types in c#?

0 Answers  


Categories