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

Can I use parseint?

836


Which string method is used for concatenation of two strings in c#?

949


What is the difference between hashtable and dictionary?

904


What is the implicit name of the parameter that gets passed into the set method/property of a class?

870


What are the advantages of clr procedure over t-sql procedure?

947


What is the difference between a private assembly and a shared assembly?

957


Is dll a library?

862


Please write a program to display “welcome to bestinterviewquestion.com” in c#?

865


How are Windows programs different from normal C-programs?

2137


What is private void in c#?

851


What is parameter c#?

950


Which property do we set on a Combo Box to display data on it prior to setting the DataSource ?

888


How to declare a property in a class?

963


Classes and structs can be declared as static, is this statement true or false?

978


What is void in c#?

886