-
Junior Member
Inherit multiple interfaces with conflicting method names
What happens if you inherit multiple interfaces and they have conflicting method names?
interface IA
{
void sing(string song);
}
interface IB
{
void sing(string prayer);
}
Describe the implementation of the following class
class singer: IA, IB
How can I declare different methods for both interfaces and call them differently at runtime?
-
Junior Member
Re: Inherit multiple interfaces with conflicting method names
look for this code
interface IA
{
void sing(string song);
}
interface IB
{
void sing(string prayer);
}
class singer: IA, IB
{
void IA.sing(string song)
{
Console.WriteLine("From interface IA "+song);
}
void IB.sing(string song)
{
Console.WriteLine("From interface IB "+song);
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules