Witam. Mam klase:
class Test
{
public:
test();
QString dana;
void funkcja();
};
void Test::funkcja()
{
QString tmp = "Test";
dana = tmp;
}
#include <QtCore/QCoreApplication>
#include <QDebug>
#include "test.h"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
Test test;
qDebug() << test.dana;
return a.exec();
}
I teraz pytanie, jak przekopiować zawartość tmp do dana? Rozumiem, że do dana przypisywana jest tylko referencja do tmp, a po zakończeniu funkcji tmp jest usuwane. Więc jak wykonać takie przypisanie?