In which file do we put non-member function in C++?
问题 What is the normal practice when it comes to non-member function in C++? Do we put them in main.cpp or header file or class implementation file, or do we make a separate .cpp file for it? If the normal practice is to make a separate file, then where do we put the non-member function header(prototype)? Does it only go in main.cpp or in both of them? 回答1: I would say you should not treat non-member functions differently to classes and member functions and other symbols. You should create a