【Qt】【QString】-拷贝构造
#include <QDebug>
QString str1 = "goodmao";
QString str2 = QString(str1);
str1 = "tom";
qDebug("str1 : %s, str2: %s",
qPrintable(str1), qPrintable(str2));
【输出】:
str1 : tom, str2: goodmao
博客围绕Qt中的QString展开,提及了QString的拷贝构造,最后输出了str1 : tom, str2: goodmao 。
【Qt】【QString】-拷贝构造
#include <QDebug>
QString str1 = "goodmao";
QString str2 = QString(str1);
str1 = "tom";
qDebug("str1 : %s, str2: %s",
qPrintable(str1), qPrintable(str2));
【输出】:
str1 : tom, str2: goodmao
1966
2642
149

被折叠的 条评论
为什么被折叠?