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

How do you create multiple inheritance in C#?

Answer Posted / pavankumar

C# doesn't support Multiple Inheritance,,,SO to over come this problem Interface came into picture.Interface is not a class,but it is a parent to base class.

Interface Forest
{
void Greet();
}

class Animal: Forest
{
public void Greet()
{
Console.WriteLine("Animal says Hello");
}

public void Sing()
{
Console.WriteLine("Animal Sings");
}
}

class Program : Animal,Forest
{
static void Main(string[] args)
{
Program obj = New Program();
obj.Greet();
obj.Sing();
Console.ReadLine();
}
}

Is This Answer Correct ?    5 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a linked list c#?

885


What is the use of console readline () in c#?

861


What is difference between abstract class and interface in c#?

938


How do I move from one form to another in c#?

880


How can you access a private method of a class?

998


State two different types of access modifiers.

998


Which are the access modifiers available in c#?

954


Why can’t struct be used instead of class for storing entity?

947


What is a clr host?

951


What is default c#?

941


What is the major difference between a custom control and user control?

1042


What does out mean c#?

947


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

1044


What is the difference between System.console.WriteLine() and System.console.Write() function?example?

1061


What does clr stand for?

908