Can I get some help deciphering those errors? I don't see a reason why I can't specify a default argument... It works fine if they aren't in separate files...
Problem 1:
You can't split template stuff in multiple files, move the implementation in the header
Problem 2:
You already said which is the default value for the argument in the declaration, remove = "Hello World!" from the cpp file
1. Moved the definition to the .h file. Works, but begs the question why even bother with .cpp files in the first place if anything with templates can't be split up...
Thanks though.
2. Changed output.h to read void output(constchar* input); //Line 4
left output.cpp the same.
when I try compiling, it complains that at main.cpp:6 there are too few arguments to function 'void output(const char*)' output(); //Line 6
I guess it didn't figure out that the function was overloaded?
@Bazzy
It isn't true that templates cannot be split into seperate header and cpp files.
If you want to limit the types that can be used with the template you can put the
declarations in the h file, and the definition and explicit instantiations in the cpp file.
Foer example - a writer of a library may want to do this (supply the h file, and the cpp file(s) already compiled .lib).