1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
/* Demonstrates the overridable variable in nested scope. Used to track current parent
* suite when declaring test case.
* => implementation not accepted, declaration conflicts occurred
* in some cases.
*/
#include <stdio.h>
namespace Other {
const char *currentSuite = "Base";
}
using Other::currentSuite;
namespace {
const char *parent0 = currentSuite;
const char *currentSuite = "Root";
const char *parent1 = currentSuite;
namespace {
const char *parent2 = currentSuite;
const char *currentSuite = "Child1";
const char *parent3 = currentSuite;
}
}
int main( int argc, const char *argv[] )
{
printf( "Parent0: %s\n", parent0 );
printf( "Parent1: %s\n", parent1 );
printf( "Parent2: %s\n", parent2 );
printf( "Parent3: %s\n", parent3 );
return 0;
}
|