I cannot find the definition of the =
operator on its official document, neither can I find it in the source code of QChar. But I can use =
without problem.
QChar c = QChar('c');
QChar d = c;
c = d;
Why?
In C++, the compiler generates an implicit assignment operator if the class does not define one.
From cppreference.com — Copy assignment operator:
Implicitly-declared copy assignment operator
If no user-defined copy assignment operators are provided for a class type, the compiler will always declare one as an inline public member of the class.
For a class such as QChar which only stores a single member of plain old data, the implicit assignment operator is sufficient as all that is required is to copy the member’s value.