Adding a set accessor to a property in a class that derives from an abstract class with only a get accessor

后端 未结 3 650
一整个雨季
一整个雨季 2021-01-07 22:47

I have an abstract class, AbsClass that implements an interface, IClass. IClass has a couple properties with only Get acce

3条回答
  •  失恋的感觉
    2021-01-07 23:04

    I am kind of curious as to why you would want these implementation classes to have public setter methods that are not part of the public interface. It sounds to me like you may actually want these to be more restricted than public?

    Other than that, I'm having a hard time thinking of a problem with this approach. They would "hide" any properties from the superclass, but there are no property setters in the superclass anyway, so that seems ok. It seems like it may be the simplest workaround.

提交回复
热议问题