Go back to Richel Bilderbeek's homepage.

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

 

 

 

 

 

(C++) free function

 

A free function is a non-member function of a class:

 

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

 

Avoid free functions (except operator functions) at file scope in header (.h) files [1]. Avoid free functions with external linkage (including operator functions) in implementation (.cpp) files [1].

 

 

 

 

 

References

 

  1. John Lakos. Large-Scale C++ Software Design. 1996. ISBN: 0-201-63362-0. Chapter 2.3.2

 

 

 

 

 

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

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict