如何限定函数只在本cpp内有效

1、static关键字

static void s_funName()
{

  return;
}

2、namespace 不要给命名空间名字这样外部 也调用不了

namespace

{

  void s_funName();

}

原文地址:https://www.cnblogs.com/likemao/p/10317994.html