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


If there are 2 interface IParentInterface &
IChildInterface as follows.

interface IParentInterface
{
void InterfaceMethod();
}

interface IChildInterface : IParentInterface
{
void InterfaceMethod();
}

Both the interface contains method with same name
InterfaceMethod().

How InterfaceMethod() will be handled in IChildInterface as
its deriving IParentInterface

Answers were Sorted based on User's Feedback



If there are 2 interface IParentInterface & IChildInterface as follows. interface IParentI..

Answer / sagar

using explicit type casting this scenario is possible.

interface IParentInterface
{
void InterfaceMethod();
}

interface IChildInterface : IParentInterface
{
void InterfaceMethod();
}
class Parent : IChildInterface
{
void IParentInterface.InterfaceMethod()
{
Console.WriteLine("Parent Interface");
}
void IChildInterface.InterfaceMethod()
{
Console.WriteLine("Child Interface");
}
static void Main()
{
Parent p = new Parent();
IParentInterface i1 = p;
IChildInterface i2 = p;
i1.InterfaceMethod();
i2.InterfaceMethod();
Console.ReadLine();

}
}

Is This Answer Correct ?    14 Yes 0 No

If there are 2 interface IParentInterface & IChildInterface as follows. interface IParentI..

Answer / vijay

In this scenario,
Whenever the child interface is called, by default
InterfaceMethod() of childe interface is gets called.

Is This Answer Correct ?    3 Yes 2 No

If there are 2 interface IParentInterface & IChildInterface as follows. interface IParentI..

Answer / anurag

use
void IChildInterface.InterfaceMethod(){}
don't use access modifier with explicit method.

Is This Answer Correct ?    2 Yes 4 No

Post New Answer

More C Sharp Interview Questions

Which of these statements correctly declares a two-dimensional array in c#?

0 Answers  


How do you inherit a class into other class in c#?

0 Answers  


What is parameters in c#?

0 Answers  


What is type system in c#?

0 Answers  


What the different phase/steps of acquiring a proxy object in webservice?

0 Answers  


Explain About friend and Protected friend

0 Answers  


what is the default access for a class

0 Answers   Cognizant,


Can you use foreach iteration on arrays in c#?

0 Answers  


What is the difference between class and namespace?

0 Answers  


What is the difference between internal and private in c#?

0 Answers  


What is asp net c#?

0 Answers  


If we inherit a class do the private variables also get inherited ?

6 Answers   TCS,


Categories