質問編集履歴
2
質問文を修正致しました。失礼いたしました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
###前提・実現したいこと
|
2
2
|
|
3
|
-
引数つきのコンストラクタを追加したところエラーが起きま
|
3
|
+
引数つきのコンストラクタを追加したところエラーが起き、原因が分かりません。
|
4
|
+
|
5
|
+
すいません、勉強して一週間もたっていなくて、質問が投げやりな感じになってしまって申し訳ありませんが、回答お願い致します。
|
4
6
|
|
5
7
|
|
6
8
|
|
1
メイン文、ヘッダー文、エラー文を一部修正しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -17,6 +17,16 @@
|
|
17
17
|
/usr/include/string.h:129:14: note: candidate function not viable: no known conversion from 'char' to 'const char *restrict' for 2nd argument; remove *
|
18
18
|
|
19
19
|
extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
|
20
|
+
|
21
|
+
^
|
22
|
+
|
23
|
+
Phone.cpp:37:21: warning: ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]
|
24
|
+
|
25
|
+
Phone p2(false, "p2","noraml");
|
26
|
+
|
27
|
+
^
|
28
|
+
|
29
|
+
1 warning and 1 error generated.
|
20
30
|
|
21
31
|
^
|
22
32
|
|
@@ -56,11 +66,13 @@
|
|
56
66
|
|
57
67
|
|
58
68
|
|
59
|
-
Phone::Phone(bool i, char* plan){
|
69
|
+
Phone::Phone(bool i, char* plan, string pInfo){
|
60
70
|
|
61
71
|
this->i = i;
|
62
72
|
|
63
73
|
strcpy(this->plan,*plan);
|
74
|
+
|
75
|
+
this->pInfo = "nokia";
|
64
76
|
|
65
77
|
}
|
66
78
|
|
@@ -98,7 +110,7 @@
|
|
98
110
|
|
99
111
|
Phone p1;
|
100
112
|
|
101
|
-
|
113
|
+
Phone p2(false, "p2","noraml");
|
102
114
|
|
103
115
|
p1.i = false;
|
104
116
|
|
@@ -114,6 +126,8 @@
|
|
114
126
|
|
115
127
|
}
|
116
128
|
|
129
|
+
|
130
|
+
|
117
131
|
<ヘッダー文>
|
118
132
|
|
119
133
|
#include <string.h>
|
@@ -126,7 +140,7 @@
|
|
126
140
|
|
127
141
|
Phone();
|
128
142
|
|
129
|
-
Phone(bool i, char* plan);
|
143
|
+
Phone(bool i, char* plan, std::string pInfo);
|
130
144
|
|
131
145
|
~Phone();
|
132
146
|
|