In C++, I've heard that you need to separate the implementation from the interface in order to reduce compile times. In this question, the answerer basically says that if you change the header then the source is recompiled, so if you separate the interface from the implementation then there is less chance you will need to change the header. But here are the two scenarios I see:
Have all code in header file
Whenever you change any code, the entire file is recompiled.
Have code in separate header files and source files
Since the header file is usually copy and pasted (via include) into the source file, if you make a change to either the header or source files the whole file will still have to be recompiled because it is as if they are one file.
Whether you change either the header or the source file, the whole file (both the header and the source) are recompiled.
So then what is the advantage of separating interface from implementation? You might say it is so that you can have multiple implementations for a single interface by means of inheritance, but can't you still do that when you have all the code in the header file? You could also say that it is so that the interface does not see any implementation details, but what is the use of that?
The only reason I can see why separating interface from implementation is that if the C++ compiler skips over the part of the source file that is the header file that is copy and pasted into the source code if it is not changed and just compiles the rest of the source file. So is this the case? Do C++ compilers skip compilation of certain parts of files that have not changed? I know that that is probably not what happens, but I cannot think of any other explanation.
Edit
I've already seen this question. What I am asking is why are the compilation times faster with separate implementation and interface files. I understand that there are advantages with separate implementation and interface files such as what Lightness Races in Orbit stated, but I am asking is why are compile times better if they are at all.