質問編集履歴
2
誤字修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -8,77 +8,107 @@
|
|
8
8
|
|
9
9
|
━━━━━ Actualクラス ━━━━━
|
10
10
|
|
11
|
-
1 #in
|
11
|
+
1 #ifndef ACTUAL
|
12
12
|
|
13
|
-
2
|
13
|
+
2 #define ACTUAL
|
14
14
|
|
15
|
-
3
|
15
|
+
3
|
16
16
|
|
17
|
-
4 cl
|
17
|
+
4 #include "callback.h"
|
18
18
|
|
19
|
-
5
|
19
|
+
5
|
20
20
|
|
21
|
-
6
|
21
|
+
6 class Callback;
|
22
22
|
|
23
|
-
7
|
23
|
+
7 class Actual {
|
24
24
|
|
25
|
-
8
|
25
|
+
8 public:
|
26
26
|
|
27
|
-
9
|
27
|
+
9 int get() {
|
28
28
|
|
29
|
+
10 return 3;
|
30
|
+
|
31
|
+
11 }
|
32
|
+
|
33
|
+
12 Callback *callback;
|
34
|
+
|
29
|
-
1
|
35
|
+
13 };
|
36
|
+
|
37
|
+
14
|
38
|
+
|
39
|
+
15 #endif
|
30
40
|
|
31
41
|
|
32
42
|
|
33
43
|
━━━━━ Callbackクラス ━━━━━
|
34
44
|
|
35
|
-
1 #in
|
45
|
+
1 #ifndef CALLBACK
|
36
46
|
|
37
|
-
2
|
47
|
+
2 #define CALLBACK
|
38
48
|
|
39
|
-
3
|
49
|
+
3
|
40
50
|
|
41
|
-
4 cl
|
51
|
+
4 #include "logic.h"
|
42
52
|
|
43
|
-
5
|
53
|
+
5
|
44
54
|
|
45
|
-
6
|
55
|
+
6 class Logic;
|
46
56
|
|
47
|
-
7
|
57
|
+
7 class Callback {
|
48
58
|
|
49
|
-
8
|
59
|
+
8 public:
|
50
60
|
|
51
|
-
9
|
61
|
+
9 void func() {
|
52
62
|
|
63
|
+
10 logic->print();
|
64
|
+
|
65
|
+
11 }
|
66
|
+
|
67
|
+
12 Logic *logic;
|
68
|
+
|
53
|
-
1
|
69
|
+
13 };
|
70
|
+
|
71
|
+
14
|
72
|
+
|
73
|
+
15 #endif
|
54
74
|
|
55
75
|
|
56
76
|
|
57
77
|
━━━━━ Logicクラス ━━━━━
|
58
78
|
|
59
|
-
1 #in
|
79
|
+
1 #ifndef LOGIC
|
60
80
|
|
61
|
-
2 #in
|
81
|
+
2 #define LOGIC
|
62
82
|
|
63
|
-
3
|
83
|
+
3
|
64
84
|
|
65
|
-
4
|
85
|
+
4 #include <iostream>
|
66
86
|
|
67
|
-
5 cla
|
87
|
+
5 #include "actual.h"
|
68
88
|
|
69
|
-
6
|
89
|
+
6 using namespace std;
|
70
90
|
|
71
|
-
7
|
91
|
+
7
|
72
92
|
|
73
|
-
8
|
93
|
+
8 class Actual;
|
74
94
|
|
75
|
-
9
|
95
|
+
9 class Logic {
|
76
96
|
|
77
|
-
10
|
97
|
+
10 public:
|
78
98
|
|
79
|
-
11
|
99
|
+
11 void print() {
|
80
100
|
|
101
|
+
12 cout << actual->get() << endl;
|
102
|
+
|
103
|
+
13 }
|
104
|
+
|
105
|
+
14 Actual *actual;
|
106
|
+
|
81
|
-
1
|
107
|
+
15 };
|
108
|
+
|
109
|
+
16
|
110
|
+
|
111
|
+
17 #endif
|
82
112
|
|
83
113
|
|
84
114
|
|
1
エラー出力を追記しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
5 public:
|
20
20
|
|
21
|
-
6
|
21
|
+
6 int get() {
|
22
22
|
|
23
23
|
7 return 3;
|
24
24
|
|
@@ -94,7 +94,7 @@
|
|
94
94
|
|
95
95
|
5 int main() {
|
96
96
|
|
97
|
-
6 Acta
|
97
|
+
6 Actual actual;
|
98
98
|
|
99
99
|
7 Callback callback;
|
100
100
|
|
@@ -118,4 +118,32 @@
|
|
118
118
|
|
119
119
|
```
|
120
120
|
|
121
|
+
|
122
|
+
|
123
|
+
エラー出力を以下に示します。
|
124
|
+
|
125
|
+
```
|
126
|
+
|
127
|
+
In file included from callback.h:4:0,
|
128
|
+
|
129
|
+
from actual.h:4,
|
130
|
+
|
131
|
+
from main.cpp:1:
|
132
|
+
|
133
|
+
logic.h: In member function ‘void Logic::print()’:
|
134
|
+
|
135
|
+
logic.h:12:17: error: invalid use of incomplete type ‘class Actual’
|
136
|
+
|
137
|
+
cout << actual->get() << endl;
|
138
|
+
|
139
|
+
^~
|
140
|
+
|
141
|
+
logic.h:8:7: note: forward declaration of ‘class Actual’
|
142
|
+
|
143
|
+
class Actual;
|
144
|
+
|
145
|
+
```
|
146
|
+
|
147
|
+
|
148
|
+
|
121
149
|
解消方法をご存知の方がおりましたら、教えて頂けると幸いです。
|