Should I recommend sealing classes by default?

后端 未结 13 1016
青春惊慌失措
青春惊慌失措 2021-01-30 01:57

In a big project I work for, I am considering recommending other programmers to always seal their classes if they haven\'t considered how their classes should be subclassed. Oft

13条回答
  •  佛祖请我去吃肉
    2021-01-30 02:59

    Your house, your rule.

    You can also have the complementary rule instead: a class that can be subclassed must be annotated; nobody should subclass a class that's not annotated so. This rule is not harder to follow than your rule.

提交回复
热议问题