O'Reilly logo
  • Nicholas Fey thinks this is interesting:

A user cannot directly refer to a private member


Cover of Programming: Principles and Practice Using C++, Second Edition


Have to double check this interpretation but... Class definitions have interface and implementation thus a class is in a round about way similar to a function with scoping rules. Public scope is just that and provides what a pointer within a function would provide, that a variable within is accessible from the outside through a reference.

Private members are local to the class and therefore can only be accessed from within that scope.

Code becomes secure from malicious injection if data is not directly available from the outside.