Have you ever seen design with reasonable usage of protected internal access modifier?

前端 未结 6 814
野的像风
野的像风 2021-02-13 04:01

I haven\'t, but I don\'t say there isn\'t one.

All of the C# developers who read this probably do know what is protected internal and when to use it. My question is simp

6条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-13 04:40

    All protected or internal members increase complexity, coupling and therefore reducing abstractions integrity. You may thinking implementing some methods internal or protected, but using internal or protected fields in general is very bad idea. Protected/internal fields "open" your abstractions implementation for wide range of classes and highly complicate future modifications.

    I don't like words like "never" or "do not" as design guidelines, but we definitely should use at least "avoid" suggestion as common design guideline.

提交回复
热议问题