-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path08.cpp
More file actions
70 lines (65 loc) · 725 Bytes
/
08.cpp
File metadata and controls
70 lines (65 loc) · 725 Bytes
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//8. 이름 충돌을 방지하는 namespace
// :: 스코프연산자
#include <iostream>
using namespace std;
//
//namespace DemoA
//{
// struct Stack
// {
// int top;
// };
//}
//
//namespace DemoB
//{
// struct Stack
// {
// int last;
// };
//}
//int main()
//{
// DemoA::Stack stacka;
// DemoB::Stack stackb;
//
// stacka.top = -1;
// stackb.last = -2;
// return 0;
//}
//---------------------
namespace DemoA
{
struct Stack
{
int top;
};
struct Queue
{
int front;
int rear;
};
}
namespace DemoB
{
struct Stack
{
int last;
};
struct Queue
{
int first;
int last;
};
}
using namespace DemoA;
int main()
{
Stack s;
Queue q;
s.top = -1;
q.rear = q.front = 0;
DemoB::Stack s2;
s2.last = -1;
return 0;
}