On 21.07.2010 00:57, Mike Linford wrote:
I'm playing with QtD, and I tried to override a QWidget's sizeHint()
function, which is declared as const QSize sizeHint(). I tried to
override it by declaring my function as override const(QSize) sizeHint
() . I got a compiler error that it was "not covariant" with const QSize,
and when I changed it to that it worked fine. I've skimmed through the
documentation but don't understand what the difference is. Any help?

In the first case, it's the function itself that ends up being const, not its return value. It's like putting 'const' after the parameter list in C++. In the second case, only the return value is const.

Reply via email to