Skip to content

Latest commit

 

History

History
92 lines (59 loc) · 2.06 KB

CppHelperFunction.md

File metadata and controls

92 lines (59 loc) · 2.06 KB

 

 

 

 

 

 

A helper function is a non-member function that belongs to a class:

 


Point operator+(const Point& lhs, const Point& rhs) {   return Point(lhs.GetX() + rhs.GetX(), lhs.GetY() + rhs.GetY()); }

 

 

 

 

 

 

 

 

 

 

 

 

  1. John Lakos. Large-Scale C++ Software Design. 1996. ISBN: 0-201-63362-0. Chapter 2.3.2
  2. Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 18.5. Advice. page 548: '[7] Use namespaces to associate helper functions with "their" class'
  3. Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 18.5. Advice. page 548: '[8] Use nonmember functions for symmetric operators'