Is it possible to implement static
class member functions in *.cpp file instead of doing
it in the header file ?
Are all static
functions always inline
?
|
It is. test.hpp:
test.cpp:
They're not always inline, no, but the compiler can make them. |
|||
|
Try this: header.hxx:
class.cxx:
|
|||
|
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? |
|||||
|
Sure You can. I'd say that You should. This article may be usefull: |
|||
|
To know more about how c++ handles static functions visit: Are static member functions in c++ copied in multiple translation units? |
||||
|