Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace {
- inline void better(); // give the function a unique name
- }
- static inline void worse(); // kludge the linker to allowing duplicates
- inline int Foo()
- {
- return 1;
- }
- int Bar1()
- {
- return Foo();
- }
- inline int Foo()
- {
- return 2;
- }
- int Bar2()
- {
- return Foo();
- }
- // file.h
- static void foo () {}
- struct A {
- static void foo () {}
- };
- // file1.cpp
- #include"file.h"
- void x1 ()
- {
- foo(); // different function exclusive to file1.cpp
- A::foo(); // same function
- }
- // file2.cpp
- #include"file.h"
- void x2 ()
- {
- foo(); // different function exclusive to file2.cpp
- A::foo(); // same function
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement