Override get, But not set

前端 未结 13 2436
暖寄归人
暖寄归人 2020-12-14 14:17

I have an abstract class that defines a get, but not set, because as far as that abstract class is concerned, it needs only a get.

相关标签:
13条回答
  • 2020-12-14 15:05

    Are you sure that doing what you are trying to do would be a good design if you found a way to do it?

    It would allow objects of the subclass to make state changes that objects of the parent class can not make. Wouldn't that violate the Liskov Substitution Principle?

    0 讨论(0)
提交回复
热议问题