Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) helper function

 

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());
}

 

 

 

 

 

Advice

 

 

 

 

 

 

References

 

  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'

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict