can we access a private variable using an object

前端 未结 7 1859
一整个雨季
一整个雨季 2020-12-11 08:07

We cannot access a private variable of a class from an object, which is created outside the class, but it is possible to access when the same object is created inside the cl

7条回答
  •  一生所求
    2020-12-11 08:50

    You are maybe confusing object and class, public/private/protected/internal affect class visibility not object visibility. That means an object of a class can access attributes of another object of the same class, even if they are private.

    I am not sure I understood your question correctly...

提交回复
热议问题