C++, static vs. namespace vs. singleton

后端 未结 6 1588
孤城傲影
孤城傲影 2020-12-01 07:34

I already read a lot of posts and articles all over the net, but I couldn\'t find a definite answer about this.

I have some functions with similar purposes that I wa

6条回答
  •  春和景丽
    2020-12-01 08:07

    The classic C way of doing this, which seems to be what you want, is to put the public function declarations in a header file, and all the implementation in source file, making the variables and non-public functions static. Otherwise just implement it as a class - I think you are making a bit of a mountain out of a molehill here.

提交回复
热议问题