www.digitalmars.com         C & C++   DMDScript  

D - typo/mistake in class.html ?

reply A casual observer <A_member pathlink.com> writes:
In the documentation, class.html describes an invariant function with the
following example:

class Date
{
int day;
int hour;

invariant()
{
assert(1 <= day && day <= 31);
assert(0 <= hour && hour < 24);
}
}

I believe (based on experiments with the compiler) that the () need to be left
off the invariant declaration:

invariant
{
assert(1 <= day && day <= 31);
assert(0 <= hour && hour < 24);
}
Sep 11 2003
parent "Walter" <walter digitalmars.com> writes:
You're right. I'll make the corrections. Thanks!
Sep 13 2003