Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:24

0001 // name=using_test ; gcc $name.cc -std=c++11 -lstdc++ -I.. -o /tmp/$name && /tmp/$name
0002 
0003 /**
0004 
0005 Unfortunately cannot switch beween class/struct statics (eg from TComplex to _TComplex with "using".
0006 It only works to shorten namespace usage. 
0007 
0008 **/
0009 
0010 #include <cstring>
0011 #include <cstdio>
0012 
0013 namespace Demo
0014 {
0015     static const char* Hello(){ return strdup("Demo::Hello") ; } 
0016 }
0017 namespace AltDemo
0018 {
0019     static const char* Hello(){ return strdup("AltDemo::Hello") ; } 
0020 }
0021 
0022 int main()
0023 {
0024     printf("Demo::Hello()    :  %s\n", Demo::Hello() ); 
0025     printf("AltDemo::Hello() :  %s\n", AltDemo::Hello() ); 
0026 
0027     {
0028         using Demo::Hello ; 
0029         printf("using Demo::Hello ; Hello() : %s\n",Hello() ); 
0030     }
0031 
0032     {
0033         using AltDemo::Hello ; 
0034         printf("using AltDemo::Hello ; Hello() : %s\n",Hello() ); 
0035     }
0036 
0037     return 0 ; 
0038 }
0039 
0040