✅ Confusion over defining a default implementation on an interface
I have an interface I'll call
When looking up some of the docs online I see this is expected behavior and has something to do with preventing breaking changes. What I'm not finding is answers to two questions:
IWidget, and a class which implements it called Widget. I created a property IWidget with a default implementation. However, I cannot access that property on a Widget instance. My expectation was that any class/interface which implements IWidget would get its default implementation.When looking up some of the docs online I see this is expected behavior and has something to do with preventing breaking changes. What I'm not finding is answers to two questions:
- What's the benefit of providing an implementation to begin with if it's not direclty accessable?
- What's the best pattern to follow if there's shared behavior across all implementations of
IWidget? I would assume an extension forIWidgetbut would like to confirm