1 // Test using statements in C++
5 #include <testusing.hh>
12 typedef MyClass snerk
;
24 int global_variable
= 0;
35 ; //#1# ( "getVal" "setVal" )
39 // Code from Zhiqiu Kong
43 using namespace bread_name
;
54 // Local using statements and aliased types
55 // Code from David Engster
59 using namespace somestuff
;
62 ; //#3# ( "aFunc" "anInt" )
67 using somestuff::OneClass
;
70 ; //#4# ( "aFunc" "anInt" )
73 // Dereferencing alias types created through 'using' statements
75 // Alias with fully qualified name
78 otherstuff::OneClass f
;
80 ; //#5# ( "aFunc" "anInt" )
83 // Alias through namespace directive
86 using namespace otherstuff
;
89 ; //#6# ( "aFunc" "anInt" )
95 using namespace morestuff
;
96 OneClass f
; // Alias for somestuff::OneClass
98 ; //#7# ( "aFunc" "anInt" )
99 aStruct g
; // This however is morestuff::aStruct !
101 ; //#8# ( "anotherBar" "anotherFoo" )
105 // Currently doesn't work interactively for some reason.
108 using namespace evenmorestuff
;
111 ; //#7# ( "aFunc" "anInt" )
114 // Alias for struct in nested namespace, fully qualified
117 outer::StructNested f
;
119 ; //#8# ( "one" "two" )
122 // Alias for nested namespace
125 using namespace outerinner
;
129 ; //#9# ( "one" "two" )
131 ; //#10# ( "four" "three" )
134 // arch-tag: 8e68d5d1-4d48-47c6-a910-d8d6b66b2768