© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
23 replies
LastExceed

✅ how can i let an interface implement a function of a super-interface, instead of shadowing it?

public class MyClass : IOne;

public interface IOne : ITwo
{
    public void Foo()
    {
        Console.WriteLine();
    }
}

public interface ITwo
{
    public void Foo();
}
public class MyClass : IOne;

public interface IOne : ITwo
{
    public void Foo()
    {
        Console.WriteLine();
    }
}

public interface ITwo
{
    public void Foo();
}

this doesnt compile, because
IOne.Foo
IOne.Foo
is considered a separate function that shadows
ITwo.Foo
ITwo.Foo
. how do i tell
IOne
IOne
to provide a default implementation for
ITwo.Foo
ITwo.Foo
instead of shadowing it?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ How to input a reference of a class into a function with an argument of an interface
C#CC# / help
4y ago
❔ How do I implement tabbed interface in WPF?
C#CC# / help
4y ago
✅ (solved) How does a list of structs that all implement an interface live in memory?
C#CC# / help
8mo ago