None. In C and C ++, you can declare many times, saying: there is code for this function, but it is somewhere else. You can determine only once and in the place where you defined it, where the code is generated in this obj file. So, you have three .cpp files and one header - the first file that defines the class, and the other two - its objects. The obj files for the other two files will not contain any code for the class, only some information that is sufficient for the linker to place calls in the code is the defining obj file.
If you define a class in two places by implicitly placing the method definitions in the header included in several files, the linker will not mind, because the definitions are โthe sameโ, they just appear in each object initially, and the final application will include only one of the default features.
You can always make as many instances of a class as you want, and the method code is never copied. It exists in one place for all different files, functions, and so on to use and create objects of this class.
Some default constructors may be smart and need some code, some for POD structures, for example, can be fully optimized and do not need any code. This is always the case, although creating more instances does not copy any functions, including constructors.
Nicholas wilson
source share