I don't want to write a .cpp file for every simple c++ class.
when I write a class definition and declaration in a single .hpp file,
the linker complains about multiple definition of member functions which are not implemented inside the body of the class.
So I use templates to get rid of linker complaints:
// log.hpp file
template<typename T>
class log_t {
private:
    int m_cnt = 0;
public:
    void log();
};
template<typename T>
void log_t<T>::log() {
    std::cout << ++m_cnt << std::endl;
}
// some random type (int)
typedef log_t<int> log;
And then I can simply use log class in multiple .cpp files without linker complaints.
Is there something fundamentally wrong with this method?
Edit: even when i use this method will member functions become inline ?
 
     
     
     
    