Class design vs. IDE: Are nonmember nonfriend functions really worth it?

后端 未结 7 1010
面向向阳花
面向向阳花 2020-12-21 00:01

In the (otherwise) excellent book C++ Coding Standards, Item 44, titled \"Prefer writing nonmember nonfriend functions\", Sutter and Alexandrescu recommend

7条回答
  •  囚心锁ツ
    2020-12-21 01:01

    In many OOP languages non-friend non-class methods are third-class citizens that reside in an orphanage unconnected to anything. When I write a method, I like to pick good parents - a fitting class - where they have the best chances to feel welcome and help.

提交回复
热议问题