My third question here today ;-), but I am really new to c++ template programming and operator overloading.
I am trying the following:
terminallog.hh
<
This function
Terminallog &Terminallog::operator<<(const char v[]) {
std::cout << std::endl;
this->indent();
std::cout << v;
return *this;
}
is not a template, but a regular member function. If this .h file is included in several .cpp filtes, it will cause the multiple definition error you're seeing. If you declare it inline
, the compiler will allow the multiple definitions and your error should be fixed.
inline
Terminallog &Terminallog::operator<<(const char v[]) {