(1)导致重定义
# 分别在test.cpp 和 test1.cpp中定义相同的函数print
#include <iostream>
void print()
{
std::cout << __FILE__ << " ==> " << __FUNCTION__ << std::endl;
}
(2) 在cpp中增加static/inline限制时,避免了重定义
#include <iostream>
void inline print()
{
std::cout << __FILE__ << " ==> " << __FUNCTION__ << std::endl;
}
#include <iostream>
void static print()
{
std::cout << __FILE__ << " ==> " << __FUNCTION__ << std::endl;
}