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...

can you overload a method of class A in Class B if it is
derived class of A?If it is yes tell me how is it possible?

Answer Posted / bhagyashri

C# Support Inheritance & in C# multiple inheritance is
achieved by using interface.multiple interface means one
class can derived by two class..and class can be derived
only one class but more than one interface.so for multiple
inheritance we use interface
for eg:
interface i1
{
public void Method1();

}
interface i2
{
public void Method2();

}
class A:i1,i2
{
public void Method1()
{
Console.WriteLine("Hi");
}
public void Method2()
{
Console.WriteLine("Hello");
}
}
class main()
{
public static void Main()
{
A a=new A();
a.Method1();
a.Method2();
Console.ReadLine();
}
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between console application and windows application?

942


What is readline library?

906


How can I make sure my c# classes will interoperate with other .net languages?

963


What are strongly typed objects?

868


Is string value type c#?

835


What is Reflection in .NET? Namespace? How will you load an assembly which is not referenced by current assembly?

918


Explain how do I get deterministic finalization in c#?

885


Is null == null c#?

837


Which is better javascript or c#?

860


Why do we need singleton class in c#?

897


Write the difference between TypeOf and GetType?

989


what is IComparable

942


Major difference between Basic httpbinding and WShttpbinding?

995


What are the 4 pillars of any object oriented programming language?

824


What are custom exceptions?

862