Let's say I have a header file like this:
ABC.h
class A {
int d = 5;
int e = 6;
};
Then I include ABC.h into two source CPP files. Wouldn't then when the linker link the compilation units together, I would end up with 2 definition of class A? But then why doesn't the linker complain when I test out this experiment? I am confused.
I am compiling using Visual Studio 2017.
There are two possible kinds of answer to this question.