- Public members are the same as global variables, so every part of the code has access to them. Private members are the same as automatic variables, so only their class has access to them.
- Public members are made accessible to any running application. Private members are made accessible only to the application where the object is instantiated.
- Public members will be compiled as shared variables in a multithreaded environment. Private members will be compiled as Thread-local variables.
- Public members can be accessed by any function. Private members can be accessed only by the same class’s member functions and the friends of the class.
Join our list
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.