1
#include <iostream>
2
using namespace std;
3
4
//类内重载
5
class string_A
6

{
7
public:
8
void operator >> (istream & input)
9
{
10
11
};
12
};
13
14
void main()
15

{
16
string_A string_a;
17
//cin>>string_a; //Fail!!
18
string_a>>cin;
19
}
20
21
//类外重载
22
class string_B
23

{
24
public:
25
26
};
27
28
void operator >> (istream & input, string_B &output)
29

{
30
31
};
32
33
void Test()
34

{
35
string_B string_b;
36
cin>>string_b;
37
//string_b>>cin; //Fail
38
}

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
