Question

I just want to make sure I got the idea of public and private right.

Regarding the private access specifier, does it mean:

  • Only accessed inside the class
  • Cannot be accessed from the object of the class unless there are public class methods that can be used to access them (Can other objects use those public functions?)
  • No other object can access them

And for public:

  • Accessed from the object of the class
  • Accessed from any other object

Is that right?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top