Skip to main content

Timeline for Interfaces vs Base class

Current License: CC BY-SA 3.0

4 events
when toggle format what by license comment
Jul 1, 2021 at 14:15 comment added Wouter How about using default interface methods.
Feb 12, 2014 at 19:44 comment added Doval However, beware the Fragile Base Class Problem. You could achieve the same thing by moving the functionality of DoThat to a static DefaultDoThat method and calling it from the classes that implement the interface. Instance variables can be passed to DefaultDoThat as arguments. Classes that want a different implementation can simply not call DefaultDoThat (or call it and do additional work before/after it.) In my opinion implementation inheritance should be avoided except when you want a finite number of subclasses.
Feb 12, 2014 at 12:40 vote accept MyDaftQuestions
Feb 12, 2014 at 11:27 history answered Lotok CC BY-SA 3.0