What are helper functions in C++?

后端 未结 4 804
难免孤独
难免孤独 2021-01-31 09:50

I was trying to understand helper functions in C++ from The C++ Programming Language by Bjarne Stroustrup. But the book hasn\'t explained anything about it and the

4条回答
  •  时光说笑
    2021-01-31 10:04

    "Helper functions" are described in Bjarne Stroustrups book, and I was just reading about them yesterday. According to Stroustrup good design of a class should keep the number of functions implementing a class to a minimum. You dont want to have 50 functions in a class, according to Stroustrup. Instead you use "helper functions" that use the class interface (call the member functions). They could perhaps (not sure about this) be defined in a shared namespace to give meaning to their "relationship". You can find the paragraph in the book in chapter 9 section 9.7.5

提交回复
热议问题