TDPL Errata: Page 208
Andrej Mitrovic
andrej.mitrovich at gmail.com
Mon Aug 9 13:29:06 PDT 2010
The last example:
override bool opEquals(Object rhs)
{
// the other must be at least a Widget
auto that = cast(Widget) rhs;
if (!that)
return false;
// do they compare equals as Widgets? if not, we're done
if (!super.opEquals(that))
return false;
// is it a TextWidget?
auto that2 = cast(TextWidget) rhs;
// if not, we're done comparing with success
if (!that2)
return true;
// compare as TextWidgets
return text == that.text;
}
Last return should be:
return text == that2.text;
More information about the Digitalmars-d
mailing list