How to hide static method

后端 未结 3 722
悲哀的现实
悲哀的现实 2021-01-15 09:00

Let\'s say I have a classes, like that:

class A
{
   public static int Count()
}
class B : A
{
}
class C : A
{
}

How can I hide this static

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-15 09:39

    You can't, basically. Heck, if it's public then anyone can call it.

    You could make it protected which would allow it to be called from within B or C but not elsewhere... but you still couldn't differentiate between B and C.

提交回复
热议问题