Thursday, October 28, 2010

Interface Principle

According to the Interface Principle, functions that have signatures that mention objects of class X, and are in the same header file of class X, are part of the interface of class X, and should be put in the same namespace as class X.

This lets Koenig lookup do the right thing (most of the time).

Reference: Exceptional C++ by Herb Sutter. Addison-Wesley, 1999, p. 139.

No comments:

Post a Comment