0

A curious question about the process of Friend Functions on Cpp.

Can we use friend functions as setters and getters (Manipulators, Accessors), or in other words, what is the difference between them, knowing that setters and getters are only for a specific using, and for underlying meaning, i'm talking abour performances and robustness too.

Thank you.

rekkalmd
  • 171
  • 1
  • 12
  • 1
    making a function `friend` of a class is about accessing private members, this has nothing to do with performance. For real OOP you don't need a single getter or setter btw. – 463035818_is_not_an_ai Apr 21 '20 at 17:43
  • The simple answer is that yes, you can use them for that. The difference between them is exactly the difference between methods and free functions. – cdhowie Apr 21 '20 at 17:43

0 Answers0