Private class functions vs Functions in unnamed namespace

前端 未结 4 615
我在风中等你
我在风中等你 2020-12-25 10:22

I\'ve found myself that I tend not to have private class functions. If possible, all candidates to private class function rather I put in to unnamed namespace and pass all n

4条回答
  •  被撕碎了的回忆
    2020-12-25 10:36

    It basically comes down to a question of whether the function in question really makes sense as part of the class. If your only intent is to keep details of the class out of the header, I'd consider using the pimpl idiom instead.

提交回复
热议问题