O'Reilly logo
  • Shayne Riley thinks this is interesting:

how do you decide what protected members to expose when you design a class for inheritance? Unfortunately, there is no magic bullet. The best you can do is to think hard, take your best guess, and then test it by writing subclasses. You should expose as few protected members as possible, because each one represents a commitment to an implementation detail. On the other hand, you must not expose too few, as a missing protected member can render a class practically unusable for inheritance.


Cover of Effective Java, 2nd Edition


This is different from what I've been saying, which is to NEVER have protected members. It's been serving me well so far, but I may have to reevaluate that concept.