Neither. In C and C++, you can declare something lots of times, saying, there is code for this function, but it's somewhere else. You can only define once, and in the place where you defined it, that's where the code is generated, in that obj file. So, you have three .cpp files, and one header, the first file defining the class, the other two making objects of it. The obj files for the other two files will not contain any code for the class, just some information which is sufficient for the linker to put in calls to the code is the defining file's obj.
If you define the class in two places, by putting method definitions implicitly in a header included in multiple files, the linker won't mind, because the definitions are 'the same', they just happen to appear in each obj initially, and the final application will only include one of the one default functions generated.
You can always make as many instances of a class as you like, and the method code is never copied. It exists in one place for all the different files, functions, and on so that use and make objects of that class.
Some default constructors may be clever and need some code, some for POD structs for example may be optimised out entirely and not need any code. It's always the case though that making more instances doesn't copy any functions, including constructors.
class
orstruct
. The one exception is for compiler generated inlined methods, which are duplicated wherever used or convenient. – Reichsmark