When to create function in .cpp file

When do I need to actually write my function in a .cpp file and when can I get away with doing everything in the header file?
What? What function are you talking about? Most functions belong in source files (.cpp) not header files in the first place.

Show some code illustrating your question.

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.
Topic archived. No new replies allowed.