Do access modifiers affect reflection also?

后端 未结 4 1080
抹茶落季
抹茶落季 2020-12-19 10:14

I always believe they did, but seeing some answers here make me doubt...

Can I access private fields/properties/methods from outside a class through reflection?

4条回答
  •  轮回少年
    2020-12-19 10:56

    Yes you can: but you really should questions yourself why you're going to :)

    There is actually only one case, where it can make sense and this is a UnitTest.

提交回复
热议问题