> On 25. Nov 2019, at 11:03, Giuseppe D'Angelo via Development
> <[email protected]> wrote:
>
> 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.
Funny things can happen if the new method in the base class is virtual.
// in library libA
class A {
};
// in user code
class B {
public:
void foo();
};
now class A changes to
class A {
public:
virtual void foo();
};
Code in libA now calls “foo” on instances of subclasses of A, including
instances of B, with funny results.
I vaguely remember that we had a case of that in Qt Creator where Qt introduced
some method in one of its classes.
--
Eike Ziller
Principal Software Engineer
The Qt Company GmbH
Erich-Thilo-Straße 10
D-12489 Berlin
[email protected]
http://qt.io
Geschäftsführer: Mika Pälsi,
Juha Varelius, Mika Harjuaho
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB
144331 B
_______________________________________________
Development mailing list
[email protected]
https://lists.qt-project.org/listinfo/development