Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • Could you rephrase "As the class evolves or is used, various non-member convenience functions will appear; you don't want to modify the class interface to add something like toUpper to a string class, for example. (In the case of std::string, of course, you can't.) Scott's worry is that when this happens, you end up with inconsistent syntax:" toUpper seems to like a member, making that a convenience function is not right, correct? Commented May 13, 2011 at 10:25
  • @Umut Yes. By convenience function, I more or less meant any function that was added later, which didn't require access to the class' private members. The issue is just to allow such additional functions to use the same calling syntax, so that a later user didn't have to distinguish what was added, and what was original. Commented May 13, 2011 at 10:31
  • what do you mean by same calling syntax Commented May 13, 2011 at 10:45
  • @Umut Tabak That the same syntax is used to call both functions. Commented May 13, 2011 at 11:53
  • Scott said to prefer non-member non-friend functions - not to make all functions non-members, even those that need private/friend access rights. He didn't say to prefer friends over members, for consistent calling syntax nor for any other reason. Commented May 18, 2021 at 21:19