Item 23: Prefer Non-Member Non-Friend Functions to Member Functions

To increase encapsulation.

  • Least member functions = minimum interface
  • Encapsulate more = easier to change implementation
  • Use namespace to help you organize classes and non-member non-friend functions
    • You may split stuff of the same namespace into pieces, but a class must be defined in its entirety
Creative Commons License
This blog by Che-Liang Chiou is licensed under a Creative Commons Attribution 4.0 International License.