C# - Can publicly inherited methods be hidden (e.g. made private to derived class)

前端 未结 10 1648
说谎
说谎 2020-12-04 19:00

Suppose I have BaseClass with public methods A and B, and I create DerivedClass through inheritance.

e.g.

public DerivedClass : BaseClass {}
<         


        
10条回答
  •  隐瞒了意图╮
    2020-12-04 19:22

    The only way to do this that I know of is to use a Has-A relationship and only implement the functions you want to expose.

提交回复
热议问题