Overriding a super class's instance variables

后端 未结 9 1925
暗喜
暗喜 2020-11-30 07:47

Why are we not able to override an instance variable of a super class in a subclass?

9条回答
  •  清歌不尽
    2020-11-30 08:01

    Variables aren't accessed polymorphically. What would you want to do with this that you can't do with a protected variable? (Not that I encourage using non-private mutable variables at all, personally.)

提交回复
热议问题