Can a private variable be accessed by other instances of the same class?

John Zukowski

Yes. The private keyword restricts which classes can accesss a variable / method, not which instances. Any instance of a class can access the private instance variables of any other instance.

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact