質問編集履歴
2
イニシャライザの更新
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
回答をもとに、プログラミングのコードを修正しました。
|
2
|
+
|
3
|
+
回答頂いた方、ありがとうございます。
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
エラーに関して、stringで定義しており、char型に変換していないのに、エラーが起きており解決方法が分かりません。
|
8
|
+
|
9
|
+
すいませんが、教えて頂けたら幸いです。
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
|
1
15
|
###前提・実現したいこと
|
2
16
|
|
3
17
|
Worker.cpp で Phoneクラスのオブジェクトをコンポジションとして持っています。
|
@@ -16,27 +30,7 @@
|
|
16
30
|
|
17
31
|
ご回答頂けたら幸いです。
|
18
32
|
|
19
|
-
###発生している問題・エラーメッセージ
|
20
|
-
|
21
|
-
ales.cpp:7:100: error: use of undeclared identifier 'i'
|
22
|
-
|
23
|
-
Sales::Sales(double profit, char* client, std::string addtionalInfo ):Worker(number, name, salary, i, plan, pInfo){
|
24
|
-
|
25
|
-
^
|
26
|
-
|
27
|
-
Sales.cpp:7:103: error: use of undeclared identifier 'plan'
|
28
|
-
|
29
|
-
Sales::Sales(double profit, char* client, std::string addtionalInfo ):Worker(number, name, salary, i, plan, pInfo){
|
30
|
-
|
31
|
-
^
|
32
|
-
|
33
|
-
Sales.cpp:7:109: error: use of undeclared identifier 'pInfo'
|
34
|
-
|
35
|
-
Sales::Sales(double profit, char* client, std::string addtionalInfo ):Worker(number, name, salary, i, plan, pInfo){
|
36
|
-
|
37
|
-
^
|
38
|
-
|
39
|
-
Sales.cpp:11:3: error: no matching function for call to 'strcpy'
|
33
|
+
###発生している問題・エラーメッセージSales.cpp:11:3: error: no matching function for call to 'strcpy'
|
40
34
|
|
41
35
|
strcpy(this->addtionalInfo, addtionalInfo);
|
42
36
|
|
@@ -60,7 +54,7 @@
|
|
60
54
|
|
61
55
|
^
|
62
56
|
|
63
|
-
Sales.cpp:2
|
57
|
+
Sales.cpp:28:3: error: no matching function for call to 'strcpy'
|
64
58
|
|
65
59
|
strcpy(this->addtionalInfo, "Undifined_addtionalInfo");
|
66
60
|
|
@@ -72,13 +66,13 @@
|
|
72
66
|
|
73
67
|
^
|
74
68
|
|
75
|
-
Sales.cpp:3
|
69
|
+
Sales.cpp:33:33: error: no member named 'pInfo' in 'Sales'
|
76
70
|
|
77
71
|
cout << "s1.pInfo = " << s1.pInfo << "\n";
|
78
72
|
|
79
73
|
~~ ^
|
80
74
|
|
81
|
-
|
75
|
+
4 errors generated.
|
82
76
|
|
83
77
|
###ソースコード
|
84
78
|
|
@@ -98,7 +92,7 @@
|
|
98
92
|
|
99
93
|
|
100
94
|
|
101
|
-
Sales::Sales(double profit, char* client, std::string addtionalInfo ):Worker(number, name, salary, i, plan, pInfo){
|
95
|
+
Sales::Sales(double profit, char* client, std::string addtionalInfo, int number, char* name, double salary, bool i, char* plan, std::string pInfo):Worker(number, name, salary, i, plan, pInfo){
|
102
96
|
|
103
97
|
this->profit = profit;
|
104
98
|
|
@@ -126,6 +120,12 @@
|
|
126
120
|
|
127
121
|
|
128
122
|
|
123
|
+
Sales::~Sales(){
|
124
|
+
|
125
|
+
}
|
126
|
+
|
127
|
+
|
128
|
+
|
129
129
|
Sales::Sales():Worker(){
|
130
130
|
|
131
131
|
this->profit = 100;
|
@@ -166,6 +166,8 @@
|
|
166
166
|
|
167
167
|
}
|
168
168
|
|
169
|
+
|
170
|
+
|
169
171
|
<Sales.h>
|
170
172
|
|
171
173
|
#include <string.h>
|
@@ -186,10 +188,12 @@
|
|
186
188
|
|
187
189
|
Sales();
|
188
190
|
|
189
|
-
Sales(double profit, char* client, std::string addtionalInfo);
|
191
|
+
Sales(double profit, char* client, std::string addtionalInfo, int number, char* name, double salary, bool i, char* plan, std::string pInfo);
|
190
192
|
|
191
193
|
Sales(const Sales &obj);
|
192
194
|
|
195
|
+
~Sales();
|
196
|
+
|
193
197
|
void ShowData(Sales s1);
|
194
198
|
|
195
199
|
};
|
1
void ShowDaraへ変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -18,15 +18,7 @@
|
|
18
18
|
|
19
19
|
###発生している問題・エラーメッセージ
|
20
20
|
|
21
|
-
In file included from Sales.cpp:3:
|
22
|
-
|
23
|
-
./Sales.h:12:5: error: C++ requires a type specifier for all declarations
|
24
|
-
|
25
|
-
ShowData(Sales s1);
|
26
|
-
|
27
|
-
^
|
28
|
-
|
29
|
-
|
21
|
+
ales.cpp:7:100: error: use of undeclared identifier 'i'
|
30
22
|
|
31
23
|
Sales::Sales(double profit, char* client, std::string addtionalInfo ):Worker(number, name, salary, i, plan, pInfo){
|
32
24
|
|
@@ -86,7 +78,7 @@
|
|
86
78
|
|
87
79
|
~~ ^
|
88
80
|
|
89
|
-
|
81
|
+
7 errors generated.
|
90
82
|
|
91
83
|
###ソースコード
|
92
84
|
|
@@ -198,7 +190,7 @@
|
|
198
190
|
|
199
191
|
Sales(const Sales &obj);
|
200
192
|
|
201
|
-
ShowData(Sales s1);
|
193
|
+
void ShowData(Sales s1);
|
202
194
|
|
203
195
|
};
|
204
196
|
|