質問編集履歴
1
修正案追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -189,3 +189,83 @@
|
|
189
189
|
Windows10 Pro
|
190
190
|
|
191
191
|
VisualStudio2019 Community
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
### P.S. 解決方法
|
196
|
+
|
197
|
+
```C++
|
198
|
+
|
199
|
+
AllocSample::AllocSample(LPCWSTR arg_1, LPCWSTR arg_2) :str_1(nullptr), str_2(nullptr)
|
200
|
+
|
201
|
+
{
|
202
|
+
|
203
|
+
if (arg_1 != nullptr) {
|
204
|
+
|
205
|
+
int length = lstrlenW(arg_1) + 1;
|
206
|
+
|
207
|
+
str_1 = new wchar_t[length];
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
for (int i = 0; i < length; i++) {
|
212
|
+
|
213
|
+
str_1[i] = arg_1[i];
|
214
|
+
|
215
|
+
}
|
216
|
+
|
217
|
+
}
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
if (arg_2 != nullptr) {
|
222
|
+
|
223
|
+
int length2 = lstrlenW(arg_2) + 1;
|
224
|
+
|
225
|
+
str_2 = new wchar_t[length2];
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
for (int i = 0; i < length2; i++) {
|
230
|
+
|
231
|
+
str_2[i] = arg_2[i];
|
232
|
+
|
233
|
+
}
|
234
|
+
|
235
|
+
}
|
236
|
+
|
237
|
+
};
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
AllocSample::AllocSample(const::AllocSample& obj) :str_1(nullptr), str_2(nullptr)
|
242
|
+
|
243
|
+
{
|
244
|
+
|
245
|
+
int length = lstrlenW(obj.str_1) + 1;
|
246
|
+
|
247
|
+
this->str_1 = new wchar_t[length];
|
248
|
+
|
249
|
+
for (int i = 0; i < length; i++) {
|
250
|
+
|
251
|
+
str_1[i] = obj.str_1[i];
|
252
|
+
|
253
|
+
}
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
int length2 = lstrlenW(obj.str_2) + 1;
|
258
|
+
|
259
|
+
this->str_2 = new wchar_t[length2];
|
260
|
+
|
261
|
+
for (int i = 0; i < length2; i++) {
|
262
|
+
|
263
|
+
str_2[i] = obj.str_2[i];
|
264
|
+
|
265
|
+
}
|
266
|
+
|
267
|
+
};
|
268
|
+
|
269
|
+
```
|
270
|
+
|
271
|
+
Constructor, Copy Constructorを以上のように修正しました.
|