私は現在、いくつかの醜いコードをリファクタリングし、大きくて複雑すぎるクラス A を、サブクラス B と C を持つスーパークラス A に分割しています。
私の質問は、分割後のサブクラス B にのみ関連する過度に複雑なクラスにプライベート変数がある場合、これらを宣言する場所について普遍的に受け入れられている規則はありますか?
私のオプションは次のとおりです。
protected variable in superclass A
pro: all variables located in central location
con: some variables in superclass unused by all subclasses
private variable in subclass B
pro: only shared variables present in superclass A (more "proper"?)
con: more complicated code management
御時間ありがとうございます!