hjk41的日志

Avatar

Effecitve C++ Note 18: Strive for class interfaces that are complete and minimal

Complete here means that the clients who use the class can do all reasonable things to the class through the interfaces. And minimal means that there is no more than nessary interfaces.

Why minimal? There are several reasons:
To make the class easier to understand
To make the class easier to maintain
To make the class faster to compile

Yet there is no sense to be unduly miserly. It is often justifiable to have more than a minimal set of functions to make the class more convenient to use.

评论已关闭