Encapsule the classes and packages you design:
-
Make all data private. Try to avoid returning pointers and passing arguments by non-constant reference.
-
Make all public functions have simple and meaningful signatures; and try to ensure they can be used without understanding the design of the class.
This encapsulates "need to know".
-
C++ classes control access by using the keywords: public, protected, and private.
-
Packages implemented using C and C++ make global functions and global data private by qualifying with the static keyword. Otherwise they are public.