Using QString as the parameter
#include <QString> #include <qstd.h> using namespace qstd; class Person { public: void setNameV( QString newName) { newName += " A"; m_Name = newName; } void setNameCR( const QString& newName) { m_Name = newName; } void setNameR( QString& newName) { newName += " B"; m_Name = newName; } QString m_Name; }; int main() { Person p; QString name("1"); p.setNameCR(name); p.setNameCR("2"); p.setNameV("3"); p.setNameR(name); cout << name; }