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's the difference between abstraction and encapsulation?

941


In which order the constructor is called for an inherited class?

1121


What are PE(Portable Executable)?

1131


What is difference between ienumerable and list?

1056


What is the difference between static and private constructor in c#?

1065


If a class derives from another class, will the derived class automatically contain all the public, protected, and internal members of the base class?

1027


What is assembly version series sequence?

1043


What is the main purpose of xml?

973


Does a class need a constructor c#?

955


Can we create extension method for interface?

951


What do you mean by jagged array?

964


What is use of FormBoarderStyle Propertie

992


How do destructors and garbage collection work in c#?

981


what are the different ways a method can be overloaded?

963


What is anonymous methods in c#?

1218