const(type) vs. const type
Jonathan M Davis
jmdavisprog at gmail.com
Tue Jul 20 16:20:08 PDT 2010
On Tuesday, July 20, 2010 15:57:41 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?
IIRC,
const QSize sizeHint()
is synonymous with
QSize sizeHint() const
which means that the function is const. However,
const(QSize) sizeHint()
means that the QSize returned is const rather than the function.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list