14.inline与namespace使用

 1 #include <iostream>
 2 using namespace std;
 3 
 4 
 5 
 6 
 7 
 8 namespace all
 9 {
10     //inline作用为默认调用
11     inline namespace V2017
12     {
13         void fun(int num)
14         {
15             cout << "int" << "V2017" << endl;
16         }
17     }
18     namespace V2018
19     {
20         void fun(int num)
21         {
22             cout << "int" << "V2018" << endl;
23         }
24 
25         void fun(double num)
26         {
27             cout << "double" << "V2018" << endl;
28         }
29     }
30 }
31 
32 void main()
33 {
34     all::fun(1);
35     all::V2018::fun(1);
36     cin.get();
37 }

 

posted @ 2018-03-11 14:04  喵小喵~  阅读(210)  评论(0编辑  收藏  举报