美文网首页
container-string-构造

container-string-构造

作者: 人不知QAQ | 来源:发表于2019-08-29 15:27 被阅读0次

#include<iostream>

using namespace std;

#include <string>

void  test01()

{

string s1;//默认构造

const char* str = "hellworld!";

string s2(str);

cout << "s2= " << s2 << endl;

string s3(str);

cout << "s3= " << s3 << endl;//拷贝构造

string s4(10, 'q');

cout << "s4= " << s4 << endl;//拷贝构造

}

int main()

{

test01();

system("pause");

return 0;

}

相关文章

网友评论

      本文标题:container-string-构造

      本文链接:https://www.haomeiwen.com/subject/mdmiectx.html