C++ string()
时间: 2023-10-23 13:12:00 浏览: 87
C++中的string()是一个构造函数,用于创建一个空字符串对象。它没有参数,因此创建的字符串对象将是一个空字符串。\[2\]这个构造函数可以通过以下方式使用:
```cpp
string str;
```
这将创建一个空字符串对象str。你可以在后续的代码中对它进行赋值或者进行其他操作。
#### 引用[.reference_title]
- *1* [C++ string 类详解](https://blog.csdn.net/fuhanghang/article/details/122167791)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [string篇](https://blog.csdn.net/qq_43644454/article/details/120204728)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [C++中的string类用法简介](https://blog.csdn.net/liitdar/article/details/80498634)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文