You never need to write functions in a .cpp file. There exist libraries specifically designed to be header-only, so that linking libraries is not required (for ease of use, although time to compile will most likely be slower).
@Genado Ah I see, I was j/w, am new to C++ and noticed this project I am tinkering with has more than a few functions which only exist in the header files, thanks for the info.