Does putting a whole class definition in a ".h" make the executable larger?
<p>We define a C++ class in a ".h" and define it's methods in a ".cpp", but it makes the code look less organized.</p>

<p>I want to put all method's definition in the class definition which is in a ".h" file, but I'm worrying that the compiler generate duplicated code for the same methods/functions when one class header file is included by different files. </p>

<p>Does the linker find out and merge the duplicated code pieces to reduce the file size?</p>

<p>If not, is it better to use ".hpp" instead? I heard that a ".hpp" is for this.</p>

<p>And it does make minor difference when I just change a ".h" file for a ".hpp" (I don't know why.), compiled with G++.</p>
