Lib1.a:
#include<stdio.h>
#include<stdlib.h>
class Lib
{
public:
inline static const void Test()
{
printf("this is lib1\n");
};
void Lib1Test()
{
Lib::Test();
}
};
Lib2.a:
#include<stdio.h>
#include<stdlib.h>
class Lib
{
public:
inline static const int Test()
{
printf("this is lib2\n");
};
void Lib2Test()
{
Lib::Test(); // this will call the Test in Lib1,amazing!
}
};
lib1.a and lib2.a will be linked to test together.
What’s the reason? Did not Lib::Test redefine?
As dribeas already answered, your program is ill-formed (violates one-definition rule).
To understand why it does not fail to link, read about
COMDATsections here.