Confused about interface default implementations [Answered]
Trying out default implementations for methods in the interfaces for the first time. In the interface there's a public method that if I define in a class, that class implementation is used. However, the second method is the same concept but when called, the default implementation from the interface is called instead. I found out it has to do with the method being internal instead of public but why does it work like that?
9 Replies
Fixed it by explicitly implementing the internal method but still curious about the logic behind it compared to public methods
Because the CLR does not look at
internal
methods when considering interface implementations✅ This post has been marked as answered!
Kinda makes sense, interfaces are meant to be a promise about what you can do with a type. Having it internal breaks the promise
Now that you've bumped the thread after marking it closed, you need to manually archive it @TheBoxyBear
no idea how
Right click
Nothing about archiving in the context menu
✅ This post has been marked as answered!