Remember that “implicit data sharing” is nothing magical: it just means the class contains a handle to reference-counted data that’s shared as long as the class is certain that the data won’t change. Typical implementations of std::string work the same way.
We commonly speak of “implicitly shared” classes, but more precisely, it’s data that is implicitly shared. In the case of QStringList, the QString handles and organizational framework that make up the QList of QStrings are shared. Deriving from the QStringList won’t change that; in fact, the data in QStringList is implicitly shared because it is derived from QList<QString>, and QLists are implicitly shared.
Of course, that won’t make any additional data your class contains or manages implicitly shared.





Reply With Quote
Bookmarks