Why not duplicate class definitions when binding

If a function (or just an int variable) defined in the header says "func.h" and is included in the two object files ao and bo, then a duplication error will occur when linking ao and bo. But this does not apply to the class, that is, when the class definition in "class.h" and includes both ao and bo, there will be no problems.

What differences in the process of compiling the function / variables and class lead to this result? But what if two classes with the same name are connected?

+4
source share

Source: https://habr.com/ru/post/1620209/


All Articles