How to implement static class member functions in *.cpp file?

前端 未结 8 1463
Happy的楠姐
Happy的楠姐 2020-12-07 15:35

Is it possible to implement static class member functions in *.cpp file instead of doing it in the header file ?

Are all static functions a

8条回答
  •  [愿得一人]
    2020-12-07 15:50

    Yes you can define static member functions in *.cpp file. If you define it in the header, compiler will by default treat it as inline. However, it does not mean separate copies of the static member function will exist in the executable. Please follow this post to learn more about this: Are static member functions in c++ copied in multiple translation units?

提交回复
热议问题