Maybe, in that a cpp
almost definitely includes that header within your static library. Generally just because it's defined in the class doesn't force it to be inline, but it does definitely specify that the function has an ODR exception (which I think I called inline linkage; More on that later). So, depending on the function and it's use from within the static library it may or may not have an actual definition, depending on if the compiler inlined it and if it's being used at all.
If the compiler decided not to inline your function, when you #include
that header from a exe
which links with the static library you might think it should then get defined again, and break the one definition rule. But, you'd be wrong. Because the fact that the method is defined within the class body marks the function as having an ODR expection. Ultimately it's up to the compiler which definition it will choose (the one in the static library or the one in the exe
/whatever). Likely it will choose the first one it sees.
Note: You can achieve the ODR exception by defining the function outside of the class body and using the inline
keyword.