Hi all,

I'm having some difficulty understanding how to properly (and efficiently) write functions that receive/return QStrings. My first programming language is C and I'm very comfortable with pointers, but I only had a short crash course in C++ so I still need to pause and think whenever using references.

Anyway, Trolltech's QString Class Reference page says that "QStrings may be treated like ints or other basic types". But if that's the case, why do some QString methods return QString (e.g. QString::simplified() const ), while others return QString& (e.g. QString::remove(int, int) )?

Also, why must parameters be passed as "const QString &", rather than just "const QString" (e.g. QString(const QString & other) )?


Thanks in advance!