[Development] QTCS2019 Notes from QtQml session

Ulf Hermann ulf.hermann at qt.io
Mon Nov 25 12:35:20 CET 2019

> Il 25/11/19 10:25, Eike Ziller ha scritto:
>>> ?
>> Similar things can happen in C++ with method names.
>> C++ got the ‘override’ keyword to make these breakages detectable by 
>> tooling.
>> It looks to me like the case id==propertyname would also be detectable 
>> by tooling?
> What do you mean? Can you make an example? The whole point of shadowing 
> in C++ is to make sure that the above does NOT break.

Consider QSomething to be Qt code and the rest user code:

class QSomething {
//    struct b {};
//    void b() { qDebug() << Q_FUNC_INFO; }

void b() { qDebug() << Q_FUNC_INFO; }

class c : public QSomething {
     void x() { b(); }

int main(int argc, char *argv[])
     c ttt;

Add one of the "b" to QSomething and the user code silently stops working.


More information about the Development mailing list