Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • 6
    Please read What is the X Y problem? Commented Apr 19, 2016 at 17:23
  • 1
    So just to clarify, you're saying that only subclasses of Bar should implement Foo, but Bar itself does not implement it (and you don't have access to change it)? Commented Apr 19, 2016 at 17:24
  • 4
    It's breaks whole concept of OOP. In this case interface should know inheritors of Foo and Foo should be abstract. Commented Apr 19, 2016 at 17:26
  • 6
    What is the problem you're solving? There likely is a better approach to it. Commented Apr 19, 2016 at 17:29
  • I do not see how that would ever be useful. What happens when later you need to add a different implementation (Or you want to create a stub for unit testing)? You would be adding constraints to your code base for no reason. Commented Apr 19, 2016 at 18:55