【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】-拷贝构造
#include <QDebug>
QString str1 = "goodmao";
QString str2 = QString(str1);
str1 = "tom";
qDebug("str1 : %s, str2: %s",
qPrintable(str1), qPrintable(str2));
【输出】:
str1 : tom, str2: goodmao